├── .gitattributes ├── .gitignore ├── Editor.meta ├── Editor ├── DA_Assets.UEL.Editor.asmdef ├── DA_Assets.UEL.Editor.asmdef.meta ├── Scripts.meta └── Scripts │ ├── ContextMenuItems.cs │ ├── ContextMenuItems.cs.meta │ ├── ElementIndexNameSerializator.cs │ ├── ElementIndexNameSerializator.cs.meta │ ├── JsonSerializerInternal.cs │ ├── JsonSerializerInternal.cs.meta │ ├── ScriptGeneratorEditor.cs │ ├── ScriptGeneratorEditor.cs.meta │ ├── UitkLinkerEditor.cs │ └── UitkLinkerEditor.cs.meta ├── Examples.meta ├── Examples ├── Example Scene.unity ├── Example Scene.unity.meta ├── ExampleUXMLTemplate.uxml ├── ExampleUXMLTemplate.uxml.meta ├── New Panel Settings.asset ├── New Panel Settings.asset.meta ├── UelExample.cs └── UelExample.cs.meta ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── DA_Assets.UEL.asmdef ├── DA_Assets.UEL.asmdef.meta ├── Scripts.meta └── Scripts │ ├── Components.meta │ ├── Components │ ├── UitkBoundsField.cs │ ├── UitkBoundsField.cs.meta │ ├── UitkBoundsIntField.cs │ ├── UitkBoundsIntField.cs.meta │ ├── UitkBox.cs │ ├── UitkBox.cs.meta │ ├── UitkButton.cs │ ├── UitkButton.cs.meta │ ├── UitkDoubleField.cs │ ├── UitkDoubleField.cs.meta │ ├── UitkDropdownField.cs │ ├── UitkDropdownField.cs.meta │ ├── UitkEnumField.cs │ ├── UitkEnumField.cs.meta │ ├── UitkFloatField.cs │ ├── UitkFloatField.cs.meta │ ├── UitkFoldout.cs │ ├── UitkFoldout.cs.meta │ ├── UitkGroupBox.cs │ ├── UitkGroupBox.cs.meta │ ├── UitkHash128Field.cs │ ├── UitkHash128Field.cs.meta │ ├── UitkHelpBox.cs │ ├── UitkHelpBox.cs.meta │ ├── UitkIMGUIContainer.cs │ ├── UitkIMGUIContainer.cs.meta │ ├── UitkImage.cs │ ├── UitkImage.cs.meta │ ├── UitkIntegerField.cs │ ├── UitkIntegerField.cs.meta │ ├── UitkLabel.cs │ ├── UitkLabel.cs.meta │ ├── UitkListView.cs │ ├── UitkListView.cs.meta │ ├── UitkLongField.cs │ ├── UitkLongField.cs.meta │ ├── UitkMinMaxSlider.cs │ ├── UitkMinMaxSlider.cs.meta │ ├── UitkMultiColumnListView.cs │ ├── UitkMultiColumnListView.cs.meta │ ├── UitkMultiColumnTreeView.cs │ ├── UitkMultiColumnTreeView.cs.meta │ ├── UitkPopupWindow.cs │ ├── UitkPopupWindow.cs.meta │ ├── UitkProgressBar.cs │ ├── UitkProgressBar.cs.meta │ ├── UitkRadioButton.cs │ ├── UitkRadioButton.cs.meta │ ├── UitkRadioButtonGroup.cs │ ├── UitkRadioButtonGroup.cs.meta │ ├── UitkRectField.cs │ ├── UitkRectField.cs.meta │ ├── UitkRectIntField.cs │ ├── UitkRectIntField.cs.meta │ ├── UitkRepeatButton.cs │ ├── UitkRepeatButton.cs.meta │ ├── UitkScrollView.cs │ ├── UitkScrollView.cs.meta │ ├── UitkScroller.cs │ ├── UitkScroller.cs.meta │ ├── UitkSlider.cs │ ├── UitkSlider.cs.meta │ ├── UitkSliderInt.cs │ ├── UitkSliderInt.cs.meta │ ├── UitkTemplateContainer.cs │ ├── UitkTemplateContainer.cs.meta │ ├── UitkTextElement.cs │ ├── UitkTextElement.cs.meta │ ├── UitkTextField.cs │ ├── UitkTextField.cs.meta │ ├── UitkToggle.cs │ ├── UitkToggle.cs.meta │ ├── UitkTreeView.cs │ ├── UitkTreeView.cs.meta │ ├── UitkTwoPaneSplitView.cs │ ├── UitkTwoPaneSplitView.cs.meta │ ├── UitkUnsignedIntegerField.cs │ ├── UitkUnsignedIntegerField.cs.meta │ ├── UitkUnsignedLongField.cs │ ├── UitkUnsignedLongField.cs.meta │ ├── UitkVector2Field.cs │ ├── UitkVector2Field.cs.meta │ ├── UitkVector2IntField.cs │ ├── UitkVector2IntField.cs.meta │ ├── UitkVector3Field.cs │ ├── UitkVector3Field.cs.meta │ ├── UitkVector3IntField.cs │ ├── UitkVector3IntField.cs.meta │ ├── UitkVector4Field.cs │ ├── UitkVector4Field.cs.meta │ ├── UitkVisualElement.cs │ └── UitkVisualElement.cs.meta │ ├── GuidGenerator.cs │ ├── GuidGenerator.cs.meta │ ├── UitkLinkerBase.cs │ └── UitkLinkerBase.cs.meta ├── UEL - Manual for developers.pdf ├── UEL - Manual for developers.pdf.meta ├── VERSION_INFO.txt └── VERSION_INFO.txt.meta /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | 8 | # Visual Studio cache directory 9 | .vs/ 10 | 11 | # Autogenerated VS/MD/Consulo solution and project files 12 | ExportedObj/ 13 | .consulo/ 14 | *.csproj 15 | *.unityproj 16 | *.sln 17 | *.suo 18 | *.tmp 19 | *.user 20 | *.userprefs 21 | *.pidb 22 | *.booproj 23 | *.svd 24 | *.pdb 25 | *.opendb 26 | *.VC.db 27 | 28 | # Unity3D generated meta files 29 | *.pidb.meta 30 | *.pdb.meta 31 | 32 | # Unity3D Generated File On Crash Reports 33 | sysinfo.txt 34 | 35 | # Builds 36 | *.apk 37 | *.unitypackage 38 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9212856e1c9979445b1cee19d6d64f08 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/DA_Assets.UEL.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DA_Assets.UEL.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:18f4a329dd82a544b9708a339d2ef8c9" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Editor/DA_Assets.UEL.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cad72a16780d00e4b9ccc0e966d85404 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fbd0c2d0e52581488703712e6bf137b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Scripts/ContextMenuItems.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Xml.Linq; 8 | using UnityEditor; 9 | using UnityEngine; 10 | using UnityEngine.UIElements; 11 | 12 | namespace DA_Assets.UEL 13 | { 14 | public static class ContextMenuItems 15 | { 16 | private static bool _debug = false; 17 | 18 | private const string UI_BUILDER_TYPE_NAME = "Unity.UI.Builder.Builder, UnityEditor.UIBuilderModule"; 19 | private const string DOCUMENT_FIELD_NAME = "document"; 20 | private const string ACTIVE_OPEN_UXML_FILE_FIELD_NAME = "activeOpenUXMLFile"; 21 | private const string VISUAL_TREE_ASSET_FIELD_NAME = "visualTreeAsset"; 22 | private const string SELECTION_FIELD_NAME = "m_Selection"; 23 | 24 | [MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + ": Copy element guid hierarchy", false, 10)] 25 | private static void CopyElementGuidHierarchy_OnClick() 26 | { 27 | CopyHierarchy(guid: true, includeIndex: false, includeName: true); 28 | } 29 | 30 | [MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + ": Copy element name hierarchy", false, 11)] 31 | private static void CopyElementNameHierarchy_OnClick() 32 | { 33 | CopyHierarchy(guid: false, includeIndex: false, includeName: true); 34 | } 35 | 36 | [MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + ": Copy element index hierarchy", false, 12)] 37 | private static void CopyElementIndexHierarchy_OnClick() 38 | { 39 | CopyHierarchy(guid: false, includeIndex: true, includeName: false); 40 | } 41 | 42 | [MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + ": Copy element index + name hierarchy", false, 13)] 43 | private static void CopyElementIndexNameHierarchy_OnClick() 44 | { 45 | CopyHierarchy(guid: false, includeIndex: true, includeName: true); 46 | } 47 | 48 | //[MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + ": Test Item", false, 14)] 49 | private static void TestItem_OnClick() 50 | { 51 | GetUIBuilderWindow(out var uiBuilderType, out var currentBuilderWindow); 52 | 53 | VisualElement selectedElement = GetSingleSelectedElement(uiBuilderType, currentBuilderWindow); 54 | 55 | if (selectedElement == null) 56 | { 57 | Debug.Log($"No element selected."); 58 | return; 59 | } 60 | } 61 | 62 | private static void CopyHierarchy(bool guid, bool includeIndex, bool includeName) 63 | { 64 | GetUIBuilderWindow(out var uiBuilderType, out var currentBuilderWindow); 65 | 66 | VisualElement selectedElement = GetSingleSelectedElement(uiBuilderType, currentBuilderWindow); 67 | 68 | if (selectedElement == null) 69 | { 70 | Debug.Log($"No element selected."); 71 | return; 72 | } 73 | 74 | string json = null; 75 | 76 | if (guid) 77 | { 78 | List guids = new List(); 79 | 80 | var h = GetParentHierarchy(selectedElement); 81 | 82 | foreach (var item in h) 83 | { 84 | if (item is IHaveGuid ihg) 85 | { 86 | guids.Add(ihg.guid); 87 | } 88 | else 89 | { 90 | guids.Add(null); 91 | } 92 | } 93 | 94 | json = ElementIndexNameSerializator.ConvertGuidsToJson("_guids", guids.ToArray()); 95 | 96 | Debug.Log($"The hierarchy of component '{(string.IsNullOrWhiteSpace(selectedElement.name) ? guids.Last() : selectedElement.name)}' is copied to the clipboard."); 97 | } 98 | else 99 | { 100 | ElementIndexName[] elementIndexNames = GetParentHierarchy(selectedElement).Select(x => new ElementIndexName 101 | { 102 | Index = includeIndex ? x.parent.IndexOf(x) : UitkLinkerBase.DEFAULT_INDEX, 103 | Name = includeName ? x.name : null 104 | }).ToArray(); 105 | 106 | json = ElementIndexNameSerializator.ConvertElementsToJson("_names", elementIndexNames); 107 | 108 | #if UNITY_2021_3_OR_NEWER 109 | Debug.Log($"The hierarchy of component '{(string.IsNullOrWhiteSpace(selectedElement.name) ? selectedElement.GetType().ToString() : selectedElement.name)}' is copied to the clipboard."); 110 | #else 111 | Debug.Log($"The hierarchy of component is copied to the clipboard."); 112 | #endif 113 | } 114 | 115 | EditorGUIUtility.systemCopyBuffer = json; 116 | } 117 | 118 | //[MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + " > Add GUID to selected elements")] 119 | private static void AddGuidToSelectedElements_OnClick() 120 | { 121 | AddGuidToSelectedElements(); 122 | } 123 | 124 | //[MenuItem("Tools/" + UitkLinkerBase.Publisher + "/" + UitkLinkerBase.Product + " > Add GUID to all elements")] 125 | private static void AddGuidToAlldElements_OnClick() 126 | { 127 | AddGuidToAllElements(); 128 | } 129 | 130 | private static void GetUIBuilderWindow(out Type uiBuilderType, out EditorWindow currentBuilderWindow) 131 | { 132 | currentBuilderWindow = null; 133 | uiBuilderType = Type.GetType(UI_BUILDER_TYPE_NAME); 134 | 135 | if (uiBuilderType == null) 136 | { 137 | Debug.LogError($"'{UI_BUILDER_TYPE_NAME}' type not found."); 138 | return; 139 | } 140 | 141 | currentBuilderWindow = EditorWindow.GetWindow(uiBuilderType); 142 | if (currentBuilderWindow == null) 143 | { 144 | Debug.LogError($"UI Builder window not found with '{uiBuilderType.Name}' type."); 145 | return; 146 | } 147 | } 148 | 149 | private static void AddGuidToAllElements() 150 | { 151 | GetUIBuilderWindow(out var uiBuilderType, out var currentBuilderWindow); 152 | 153 | List selectionList = GetSelectedVisualElements(uiBuilderType, currentBuilderWindow); 154 | 155 | if (selectionList == null || selectionList.Count < 1) 156 | { 157 | Debug.LogError("No elements selected."); 158 | return; 159 | } 160 | 161 | string uxmlPath = GetUxmlPath(uiBuilderType, currentBuilderWindow); 162 | string uxmlContent = File.ReadAllText(uxmlPath); 163 | 164 | if (string.IsNullOrEmpty(uxmlContent)) 165 | { 166 | Debug.LogError("Can't open UXML file."); 167 | return; 168 | } 169 | 170 | XElement root = XElement.Parse(uxmlContent); 171 | TraverseXElement(root); 172 | root.Save(uxmlPath); 173 | 174 | void TraverseXElement(XElement element) 175 | { 176 | AddGuidAttribute(element); 177 | 178 | foreach (XElement child in element.Elements()) 179 | { 180 | TraverseXElement(child); 181 | } 182 | } 183 | } 184 | 185 | private static void AddGuidToSelectedElements() 186 | { 187 | GetUIBuilderWindow(out var uiBuilderType, out var currentBuilderWindow); 188 | 189 | List selectionList = GetSelectedVisualElements(uiBuilderType, currentBuilderWindow); 190 | 191 | if (selectionList == null || selectionList.Count < 1) 192 | { 193 | Debug.LogError("No elements selected."); 194 | return; 195 | } 196 | 197 | string uxmlPath = GetUxmlPath(uiBuilderType, currentBuilderWindow); 198 | string uxmlContent = File.ReadAllText(uxmlPath); 199 | 200 | if (string.IsNullOrEmpty(uxmlContent)) 201 | { 202 | Debug.LogError("Can't open UXML file."); 203 | return; 204 | } 205 | 206 | XElement root = XElement.Parse(uxmlContent); 207 | 208 | foreach (VisualElement item in selectionList) 209 | { 210 | Debug.Log($"Selected: {item.name}"); 211 | AddGuidAttribute(root, item); 212 | } 213 | 214 | root.Save(uxmlPath); 215 | 216 | Debug.Log("UXML file is updated."); 217 | 218 | } 219 | 220 | private static VisualElement GetSingleSelectedElement(Type uiBuilderType, EditorWindow currentBuilderWindow) 221 | { 222 | var l = GetSelectedVisualElements(uiBuilderType, currentBuilderWindow); 223 | 224 | if (l == null) 225 | return null; 226 | 227 | if (l.Count > 1) 228 | { 229 | Debug.Log($"must be 1 selected"); 230 | return null; 231 | } 232 | 233 | return l.First(); 234 | } 235 | 236 | private static List GetSelectedVisualElements(Type uiBuilderType, EditorWindow currentBuilderWindow) 237 | { 238 | FieldInfo selectionField = uiBuilderType.GetField(SELECTION_FIELD_NAME, BindingFlags.NonPublic | BindingFlags.Instance); 239 | if (selectionField == null) 240 | { 241 | Debug.LogError($"'{SELECTION_FIELD_NAME}' field not found in '{uiBuilderType.Name}' type."); 242 | return null; 243 | } 244 | 245 | object builderSelection = selectionField.GetValue(currentBuilderWindow); 246 | if (builderSelection == null) 247 | { 248 | Debug.LogError($"'{SELECTION_FIELD_NAME}' object is null."); 249 | return null; 250 | } 251 | 252 | FieldInfo selectionListField = selectionField.FieldType.GetField(SELECTION_FIELD_NAME, BindingFlags.NonPublic | BindingFlags.Instance); 253 | if (selectionListField == null) 254 | { 255 | Debug.LogError($"'{SELECTION_FIELD_NAME}' not found in '{selectionField.FieldType.Name}' type."); 256 | return null; 257 | } 258 | 259 | List selectionList = selectionListField.GetValue(builderSelection) as List; 260 | 261 | if (selectionList == null || selectionList.Count < 1) 262 | { 263 | Debug.LogError("No elements selected."); 264 | return null; 265 | } 266 | 267 | return selectionList; 268 | } 269 | 270 | private static string GetUxmlPath(Type uiBuilderType, EditorWindow currentBuilderWindow) 271 | { 272 | PropertyInfo docProp = uiBuilderType.GetProperty(DOCUMENT_FIELD_NAME, BindingFlags.Public | BindingFlags.Instance); 273 | if (docProp == null) 274 | { 275 | Debug.LogError($"'{DOCUMENT_FIELD_NAME}' property not found in '{uiBuilderType.Name}' type."); 276 | return null; 277 | } 278 | 279 | object doc = docProp.GetValue(currentBuilderWindow); 280 | if (doc == null) 281 | { 282 | Debug.LogError($"'{DOCUMENT_FIELD_NAME}' object is null."); 283 | return null; 284 | } 285 | 286 | PropertyInfo activeOpenUXMLFileProp = docProp.PropertyType.GetProperty(ACTIVE_OPEN_UXML_FILE_FIELD_NAME, BindingFlags.Public | BindingFlags.Instance); 287 | if (activeOpenUXMLFileProp == null) 288 | { 289 | Debug.LogError($"'{ACTIVE_OPEN_UXML_FILE_FIELD_NAME}' not found in '{docProp.PropertyType.Name}'"); 290 | return null; 291 | } 292 | 293 | object activeOpenUXMLFile = activeOpenUXMLFileProp.GetValue(doc); 294 | if (activeOpenUXMLFile == null) 295 | { 296 | Debug.LogError($"'{ACTIVE_OPEN_UXML_FILE_FIELD_NAME}' object is null."); 297 | return null; 298 | } 299 | 300 | PropertyInfo visualTreeAssetProp = activeOpenUXMLFileProp.PropertyType.GetProperty(VISUAL_TREE_ASSET_FIELD_NAME, BindingFlags.Public | BindingFlags.Instance); 301 | if (visualTreeAssetProp == null) 302 | { 303 | Debug.LogError($"'{VISUAL_TREE_ASSET_FIELD_NAME}' property not found in '{activeOpenUXMLFileProp.PropertyType.Name}' type."); 304 | return null; 305 | } 306 | 307 | VisualTreeAsset visualTreeAsset = visualTreeAssetProp.GetValue(activeOpenUXMLFile) as VisualTreeAsset; 308 | if (visualTreeAsset == null) 309 | { 310 | Debug.LogError($"'{VISUAL_TREE_ASSET_FIELD_NAME}' object is null."); 311 | return null; 312 | } 313 | 314 | string uxmlPath = AssetDatabase.GetAssetPath(visualTreeAsset); 315 | return uxmlPath; 316 | } 317 | 318 | private static void AddGuidAttribute(XElement root, VisualElement elementObj) 319 | { 320 | List hierarchy = GetParentHierarchy(elementObj); 321 | 322 | XElement targetElement = FindElementByHierarchy(root, hierarchy.Select(x => x.name).ToList()); 323 | 324 | if (targetElement == null) 325 | { 326 | Debug.LogError("Target element not found."); 327 | return; 328 | } 329 | 330 | AddGuidAttribute(targetElement); 331 | } 332 | 333 | private static void AddGuidAttribute(XElement element) 334 | { 335 | string guid = Guid.NewGuid().ToString(); 336 | guid = guid.Replace("-", ""); 337 | string attributeName = "guid"; 338 | element.SetAttributeValue(attributeName, guid); 339 | } 340 | 341 | static string[] _endOfHierarchy = new string[] { "document", "shared-styles-and-document", "canvas", "viewport-surface", "viewport", "viewport-wrapper" }; 342 | 343 | public static bool ValidateEndOfHierarchy(string[] endOf) 344 | { 345 | if (_endOfHierarchy.Length != endOf.Length) 346 | { 347 | throw new ArgumentException("Must be same length."); 348 | } 349 | 350 | for (int i = 0; i < _endOfHierarchy.Length; i++) 351 | { 352 | if (endOf[i] == null) 353 | { 354 | return false; 355 | } 356 | 357 | if (_endOfHierarchy[i] != endOf[i]) 358 | { 359 | return false; 360 | } 361 | } 362 | 363 | return true; 364 | } 365 | 366 | public static List GetParentHierarchy(VisualElement selectedElement) 367 | { 368 | List hierarchy = new List(); 369 | hierarchy.Add(selectedElement); 370 | 371 | VisualElement currentElement = selectedElement; 372 | 373 | while (currentElement.parent != null) 374 | { 375 | VisualElement parent = currentElement.parent; 376 | hierarchy.Add(parent); 377 | currentElement = parent; 378 | } 379 | 380 | TrimHierarchy(ref hierarchy, x => x.name); 381 | hierarchy.Reverse(); 382 | return hierarchy; 383 | } 384 | 385 | private static void TrimHierarchy(ref List hierarchy, Func propertySelector) 386 | { 387 | for (int i = 0; i < hierarchy.Count - (_endOfHierarchy.Length - 1); i++) 388 | { 389 | string[] endOfHierarchy = new string[_endOfHierarchy.Length]; 390 | for (int j = 0; j < _endOfHierarchy.Length; j++) 391 | { 392 | endOfHierarchy[j] = propertySelector(hierarchy[i + j]); 393 | } 394 | 395 | if (ValidateEndOfHierarchy(endOfHierarchy)) 396 | { 397 | hierarchy.RemoveRange(i, hierarchy.Count - i); 398 | break; 399 | } 400 | } 401 | } 402 | 403 | private static XElement FindElementByHierarchy(XElement root, List hierarchy) 404 | { 405 | string currentName = root.Attribute("name")?.Value ?? string.Empty; 406 | 407 | if (_debug) 408 | Debug.Log($"Searching in the element with attribute name='{currentName}' for {hierarchy[0]}"); 409 | 410 | if (currentName == hierarchy[0]) 411 | { 412 | if (_debug) 413 | Debug.Log($"Match found: {currentName}"); 414 | 415 | if (hierarchy.Count == 1) 416 | { 417 | if (_debug) 418 | Debug.Log("Final element found."); 419 | 420 | return root; 421 | } 422 | else 423 | { 424 | List subHierarchy = hierarchy.GetRange(1, hierarchy.Count - 1); 425 | foreach (XElement child in root.Elements()) 426 | { 427 | if (_debug) 428 | Debug.Log($"Moving to the child element with attribute name='{child.Attribute("name")?.Value}'"); 429 | 430 | XElement found = FindElementByHierarchy(child, subHierarchy); 431 | if (found != null) 432 | { 433 | return found; 434 | } 435 | } 436 | } 437 | } 438 | else 439 | { 440 | foreach (XElement child in root.Elements()) 441 | { 442 | if (_debug) 443 | Debug.Log($"Moving to the child element with attribute name='{child.Attribute("name")?.Value}' in search of {hierarchy[0]}"); 444 | 445 | XElement found = FindElementByHierarchy(child, hierarchy); 446 | if (found != null) 447 | { 448 | return found; 449 | } 450 | } 451 | } 452 | 453 | if (_debug) 454 | Debug.Log($"Element with attribute name='{hierarchy[0]}' not found in the current context {currentName}"); 455 | 456 | return null; 457 | } 458 | } 459 | } 460 | -------------------------------------------------------------------------------- /Editor/Scripts/ContextMenuItems.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d04aa42f1094a249975842fd6574ea2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/ElementIndexNameSerializator.cs: -------------------------------------------------------------------------------- 1 | using DA_Assets.UEL; 2 | using System.Collections.Generic; 3 | 4 | namespace DA_Assets.UEL 5 | { 6 | internal class ElementIndexNameSerializator 7 | { 8 | internal static string ConvertGuidsToJson(string targetFieldName, string[] array) 9 | { 10 | Dictionary mainObj = new Dictionary 11 | { 12 | ["name"] = targetFieldName, 13 | ["type"] = -1, 14 | ["arraySize"] = array.Length, 15 | ["arrayType"] = "string", 16 | ["children"] = new List 17 | { 18 | new Dictionary 19 | { 20 | ["name"] = "Array", 21 | ["type"] = -1, 22 | ["arraySize"] = array.Length, 23 | ["arrayType"] = "string", 24 | ["children"] = new List 25 | { 26 | new Dictionary 27 | { 28 | ["name"] = "size", 29 | ["type"] = 12, 30 | ["val"] = array.Length 31 | } 32 | } 33 | } 34 | } 35 | }; 36 | 37 | List arrayChildren = new List(); 38 | 39 | foreach (string child in array) 40 | { 41 | arrayChildren.Add(new Dictionary 42 | { 43 | ["name"] = "data", 44 | ["type"] = 3, 45 | ["val"] = child 46 | }); 47 | } 48 | 49 | List rootChildren = (List)mainObj["children"]; 50 | Dictionary firstChild = (Dictionary)rootChildren[0]; 51 | List innerChildren = (List)firstChild["children"]; 52 | innerChildren.AddRange(arrayChildren); 53 | 54 | string json = "GenericPropertyJSON:" + JsonSerializerInternal.Serialize(mainObj); 55 | return json; 56 | } 57 | 58 | internal static string ConvertElementsToJson(string targetFieldName, ElementIndexName[] array) 59 | { 60 | Dictionary mainObj = new Dictionary 61 | { 62 | ["name"] = targetFieldName, 63 | ["type"] = -1, 64 | ["arraySize"] = array.Length, 65 | ["arrayType"] = nameof(ElementIndexName), 66 | ["children"] = new List 67 | { 68 | new Dictionary 69 | { 70 | ["name"] = "Array", 71 | ["type"] = -1, 72 | ["arraySize"] = array.Length, 73 | ["arrayType"] = nameof(ElementIndexName), 74 | ["children"] = new List 75 | { 76 | new Dictionary 77 | { 78 | ["name"] = "size", 79 | ["type"] = 12, 80 | ["val"] = array.Length 81 | } 82 | } 83 | } 84 | } 85 | }; 86 | 87 | List arrayChildren = new List(); 88 | 89 | foreach (ElementIndexName element in array) 90 | { 91 | arrayChildren.Add(new Dictionary 92 | { 93 | ["name"] = "data", 94 | ["type"] = -1, 95 | ["children"] = new List 96 | { 97 | new Dictionary 98 | { 99 | ["name"] = "Index", 100 | ["type"] = 0, 101 | ["val"] = element.Index 102 | }, 103 | new Dictionary 104 | { 105 | ["name"] = "Name", 106 | ["type"] = 3, 107 | ["val"] = element.Name 108 | } 109 | } 110 | }); 111 | } 112 | 113 | List rootChildren = (List)mainObj["children"]; 114 | Dictionary firstChild = (Dictionary)rootChildren[0]; 115 | List innerChildren = (List)firstChild["children"]; 116 | innerChildren.AddRange(arrayChildren); 117 | 118 | string json = "GenericPropertyJSON:" + JsonSerializerInternal.Serialize(mainObj); 119 | return json; 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /Editor/Scripts/ElementIndexNameSerializator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 317e37ff94caa0340ade0ec7d4f79792 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/JsonSerializerInternal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace DA_Assets.UEL 5 | { 6 | public class JsonSerializerInternal 7 | { 8 | private static MethodInfo serializeMethod; 9 | 10 | public static string Serialize(object obj, bool pretty = false, string indentText = " ") 11 | { 12 | if (serializeMethod == null) 13 | { 14 | Type jsonType = Type.GetType("UnityEditor.Json+Serializer, UnityEditor.CoreModule"); 15 | 16 | serializeMethod = jsonType.GetMethod("Serialize", BindingFlags.Public | BindingFlags.Static, null, new Type[] 17 | { 18 | typeof(object), typeof(bool), typeof(string) 19 | }, null); 20 | } 21 | 22 | object[] parameters = new object[] { obj, pretty, indentText }; 23 | string result = (string)serializeMethod.Invoke(null, parameters); 24 | 25 | return result; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Editor/Scripts/JsonSerializerInternal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 671cd4db4b1faba43af10b39285aad19 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/ScriptGeneratorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.IO; 4 | 5 | namespace DA_Assets.UEL 6 | { 7 | public class ScriptGeneratorEditor : EditorWindow 8 | { 9 | private string[] classNames = new string[] { "BoundsField", 10 | "BoundsIntField", 11 | "Box", 12 | "Button", 13 | 14 | "DoubleField", 15 | "DropdownField", 16 | "EnumField", 17 | 18 | "FloatField", 19 | "Foldout", 20 | 21 | "GroupBox", 22 | "Hash128Field", 23 | "HelpBox", 24 | "IMGUIContainer", 25 | "Image", 26 | 27 | "IntegerField", 28 | "Label", 29 | 30 | "ListView", 31 | "LongField", 32 | 33 | "MinMaxSlider", 34 | "MultiColumnListView", 35 | "MultiColumnTreeView", 36 | 37 | "PopupWindow", 38 | "ProgressBar", 39 | 40 | "RadioButton", 41 | "RadioButtonGroup", 42 | "RectField", 43 | "RectIntField", 44 | "RepeatButton", 45 | "ScrollView", 46 | "Scroller", 47 | "Slider", 48 | "SliderInt", 49 | 50 | "TextElement", 51 | "TextField", 52 | "TemplateContainer", 53 | "Toggle", 54 | 55 | "TreeView", 56 | "TwoPaneSplitView", 57 | "UnsignedIntegerField", 58 | "UnsignedLongField", 59 | "Vector2Field", 60 | "Vector2IntField", 61 | "Vector3Field", 62 | "Vector3IntField", 63 | "Vector4Field", 64 | 65 | "VisualElement" }; 66 | 67 | //[MenuItem("Tools/Generate UI Toolkit Scripts")] 68 | private static void ShowWindow() 69 | { 70 | var window = GetWindow(); 71 | window.titleContent = new GUIContent("Script Generator"); 72 | window.Show(); 73 | } 74 | 75 | private void OnGUI() 76 | { 77 | if (GUILayout.Button("Generate Scripts")) 78 | { 79 | GenerateScripts(); 80 | } 81 | } 82 | 83 | private void GenerateScripts() 84 | { 85 | string folderPath = Path.Combine("Assets", "GeneratedScripts"); 86 | if (!Directory.Exists(folderPath)) 87 | { 88 | Directory.CreateDirectory(folderPath); 89 | } 90 | 91 | foreach (var className in classNames) 92 | { 93 | string scriptContent = $@"using UnityEngine.UIElements; 94 | 95 | namespace DA_Assets.UitkElementLinker 96 | {{ 97 | public class {className} : UnityEngine.UIElements.{className}, IHaveGuid 98 | {{ 99 | public string Guid {{ get; set; }} 100 | 101 | public new class UxmlFactory : UxmlFactory {{ }} 102 | 103 | public new class UxmlTraits : UnityEngine.UIElements.VisualElement.UxmlTraits 104 | {{ 105 | UxmlStringAttributeDescription m_Guid = new UxmlStringAttributeDescription {{ name = nameof(Guid) }}; 106 | 107 | public override void Init(UnityEngine.UIElements.{className} ve, IUxmlAttributes bag, CreationContext cc) 108 | {{ 109 | base.Init(ve, bag, cc); 110 | 111 | {className} obj = ve as {className}; 112 | obj.Guid = GuidGenerator.GenerateGuid(); 113 | }} 114 | }} 115 | }} 116 | 117 | public class Uitk{className} : UitkLinker 118 | {{ 119 | public UnityEngine.UIElements.{className} {className} => _element; 120 | }} 121 | }} 122 | "; 123 | 124 | File.WriteAllText(Path.Combine(folderPath, $"Uitk{className}.cs"), scriptContent); 125 | } 126 | 127 | AssetDatabase.Refresh(); 128 | Debug.Log("Scripts generated successfully."); 129 | } 130 | } 131 | } -------------------------------------------------------------------------------- /Editor/Scripts/ScriptGeneratorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e54d43696e8c51446bf20d7267b1db6c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Scripts/UitkLinkerEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using UnityEngine.UIElements; 5 | 6 | namespace DA_Assets.UEL 7 | { 8 | [CustomEditor(typeof(UitkLinker<>), true), CanEditMultipleObjects] 9 | public class UitkLinkerEditor : Editor 10 | { 11 | UitkLinkerBase monoBeh; 12 | 13 | Type targetType = null; 14 | 15 | void OnEnable() 16 | { 17 | targetType = target.GetType(); 18 | monoBeh = (UitkLinkerBase)target; 19 | } 20 | 21 | public override VisualElement CreateInspectorGUI() 22 | { 23 | VisualElement root = new VisualElement(); 24 | IMGUIContainer imguiContainer = new IMGUIContainer(() => 25 | { 26 | OnInspectorLegacy(root); 27 | }); 28 | 29 | imguiContainer.style.display = DisplayStyle.Flex; 30 | root.Add(imguiContainer); 31 | 32 | return root; 33 | } 34 | 35 | public void OnInspectorLegacy(VisualElement root) 36 | { 37 | serializedObject.Update(); 38 | 39 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_uiDocument")); 40 | EditorGUILayout.Space(5); 41 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_linkingMode")); 42 | EditorGUILayout.Space(5); 43 | 44 | SerializedProperty linkingMode = serializedObject.FindProperty("_linkingMode"); 45 | switch ((UitkLinkingMode)linkingMode.enumValueIndex) 46 | { 47 | case UitkLinkingMode.Name: 48 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_name")); 49 | break; 50 | case UitkLinkingMode.IndexNames: 51 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_names")); 52 | break; 53 | case UitkLinkingMode.Guid: 54 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_guid")); 55 | break; 56 | case UitkLinkingMode.Guids: 57 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_guids")); 58 | break; 59 | } 60 | 61 | #if UNITY_2021_3_OR_NEWER 62 | if (target.GetType() == typeof(UitkButton)) 63 | { 64 | EditorGUILayout.Space(5); 65 | EditorGUILayout.PropertyField(serializedObject.FindProperty("_onClick")); 66 | } 67 | #endif 68 | 69 | SerializedProperty isDebug = serializedObject.FindProperty("_debug"); 70 | if (isDebug.boolValue) 71 | { 72 | GUILayout.Space(15); 73 | base.OnInspectorGUI(); 74 | } 75 | else 76 | { 77 | EditorGUILayout.PropertyField(isDebug); 78 | } 79 | 80 | serializedObject.ApplyModifiedProperties(); 81 | } 82 | 83 | 84 | [CustomPropertyDrawer(typeof(ElementIndexName))] 85 | public class ElementIndexNameDrawer : PropertyDrawer 86 | { 87 | static readonly ElementIndexName def = default; 88 | 89 | const int padding = 2; 90 | const float spacing = 10; 91 | const float indexFieldWidth = 30; 92 | const float labelWidth = 50; 93 | 94 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 95 | { 96 | EditorGUI.BeginProperty(position, label, property); 97 | EditorGUI.BeginChangeCheck(); 98 | 99 | int indent = EditorGUI.indentLevel; 100 | EditorGUI.indentLevel = 0; 101 | 102 | EditorGUIUtility.labelWidth = labelWidth; 103 | 104 | string indexName = nameof(def.Index); 105 | string nameName = nameof(def.Name); 106 | 107 | Rect indexRect = new Rect(position.x, position.y, indexFieldWidth + labelWidth, position.height); 108 | EditorGUI.PropertyField(indexRect, property.FindPropertyRelative(indexName), new GUIContent(indexName)); 109 | 110 | float nameFieldWidth = position.width - indexFieldWidth - labelWidth - padding - spacing; 111 | 112 | Rect nameRect = new Rect(position.x + indexFieldWidth + labelWidth + padding + spacing, position.y, nameFieldWidth, position.height); 113 | EditorGUI.PropertyField(nameRect, property.FindPropertyRelative(nameName), new GUIContent(nameName)); 114 | 115 | EditorGUIUtility.labelWidth = 0; 116 | EditorGUI.indentLevel = indent; 117 | 118 | if (EditorGUI.EndChangeCheck()) 119 | property.serializedObject.ApplyModifiedProperties(); 120 | 121 | EditorGUI.EndProperty(); 122 | } 123 | } 124 | } 125 | } -------------------------------------------------------------------------------- /Editor/Scripts/UitkLinkerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2686e5fbe47401448aec72121f6e9a6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e260540eb74f49419298f9a8384e04d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/Example Scene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 3 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | buildHeightMesh: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &22818353 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 22818355} 135 | - component: {fileID: 22818356} 136 | - component: {fileID: 22818354} 137 | m_Layer: 0 138 | m_Name: btn1 139 | m_TagString: Untagged 140 | m_Icon: {fileID: 0} 141 | m_NavMeshLayer: 0 142 | m_StaticEditorFlags: 0 143 | m_IsActive: 1 144 | --- !u!114 &22818354 145 | MonoBehaviour: 146 | m_ObjectHideFlags: 0 147 | m_CorrespondingSourceObject: {fileID: 0} 148 | m_PrefabInstance: {fileID: 0} 149 | m_PrefabAsset: {fileID: 0} 150 | m_GameObject: {fileID: 22818353} 151 | m_Enabled: 1 152 | m_EditorHideFlags: 0 153 | m_Script: {fileID: 11500000, guid: 3fc2fd0089a67bb45a031683c988bdfc, type: 3} 154 | m_Name: 155 | m_EditorClassIdentifier: 156 | _linkingMode: 2 157 | _guid: 158 | _guids: [] 159 | _name: 160 | _names: 161 | - Index: -1 162 | Name: elem1 163 | Init: 0 164 | - Index: 0 165 | Name: elem2 166 | Init: 0 167 | - Index: 2 168 | Name: btn1 169 | Init: 0 170 | _uiDocument: {fileID: 1739256324} 171 | _debug: 0 172 | _onClick: 173 | m_PersistentCalls: 174 | m_Calls: 175 | - m_Target: {fileID: 22818356} 176 | m_TargetAssemblyTypeName: DA_Assets.UEL.UelExample, Assembly-CSharp 177 | m_MethodName: AddPhoto_OnClick 178 | m_Mode: 1 179 | m_Arguments: 180 | m_ObjectArgument: {fileID: 0} 181 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 182 | m_IntArgument: 0 183 | m_FloatArgument: 0 184 | m_StringArgument: 185 | m_BoolArgument: 0 186 | m_CallState: 2 187 | --- !u!4 &22818355 188 | Transform: 189 | m_ObjectHideFlags: 0 190 | m_CorrespondingSourceObject: {fileID: 0} 191 | m_PrefabInstance: {fileID: 0} 192 | m_PrefabAsset: {fileID: 0} 193 | m_GameObject: {fileID: 22818353} 194 | serializedVersion: 2 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 0, z: 0} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_ConstrainProportionsScale: 0 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 202 | --- !u!114 &22818356 203 | MonoBehaviour: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInstance: {fileID: 0} 207 | m_PrefabAsset: {fileID: 0} 208 | m_GameObject: {fileID: 22818353} 209 | m_Enabled: 1 210 | m_EditorHideFlags: 0 211 | m_Script: {fileID: 11500000, guid: 5fe7f10cc6d18084d9b4eba9b0c5b1b6, type: 3} 212 | m_Name: 213 | m_EditorClassIdentifier: 214 | addPhotoBtn: {fileID: 22818354} 215 | --- !u!1 &558177090 216 | GameObject: 217 | m_ObjectHideFlags: 0 218 | m_CorrespondingSourceObject: {fileID: 0} 219 | m_PrefabInstance: {fileID: 0} 220 | m_PrefabAsset: {fileID: 0} 221 | serializedVersion: 6 222 | m_Component: 223 | - component: {fileID: 558177092} 224 | - component: {fileID: 558177093} 225 | - component: {fileID: 558177091} 226 | m_Layer: 0 227 | m_Name: buttonWithUniqueName 228 | m_TagString: Untagged 229 | m_Icon: {fileID: 0} 230 | m_NavMeshLayer: 0 231 | m_StaticEditorFlags: 0 232 | m_IsActive: 1 233 | --- !u!114 &558177091 234 | MonoBehaviour: 235 | m_ObjectHideFlags: 0 236 | m_CorrespondingSourceObject: {fileID: 0} 237 | m_PrefabInstance: {fileID: 0} 238 | m_PrefabAsset: {fileID: 0} 239 | m_GameObject: {fileID: 558177090} 240 | m_Enabled: 1 241 | m_EditorHideFlags: 0 242 | m_Script: {fileID: 11500000, guid: 3fc2fd0089a67bb45a031683c988bdfc, type: 3} 243 | m_Name: 244 | m_EditorClassIdentifier: 245 | _linkingMode: 1 246 | _guid: 247 | _guids: [] 248 | _name: buttonWithUniqueName 249 | _names: [] 250 | _uiDocument: {fileID: 1739256324} 251 | _debug: 0 252 | _onClick: 253 | m_PersistentCalls: 254 | m_Calls: 255 | - m_Target: {fileID: 558177093} 256 | m_TargetAssemblyTypeName: DA_Assets.UEL.UelExample, Assembly-CSharp 257 | m_MethodName: AddPhoto_OnClick 258 | m_Mode: 1 259 | m_Arguments: 260 | m_ObjectArgument: {fileID: 0} 261 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 262 | m_IntArgument: 0 263 | m_FloatArgument: 0 264 | m_StringArgument: 265 | m_BoolArgument: 0 266 | m_CallState: 2 267 | --- !u!4 &558177092 268 | Transform: 269 | m_ObjectHideFlags: 0 270 | m_CorrespondingSourceObject: {fileID: 0} 271 | m_PrefabInstance: {fileID: 0} 272 | m_PrefabAsset: {fileID: 0} 273 | m_GameObject: {fileID: 558177090} 274 | serializedVersion: 2 275 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 276 | m_LocalPosition: {x: 0, y: 0, z: 0} 277 | m_LocalScale: {x: 1, y: 1, z: 1} 278 | m_ConstrainProportionsScale: 0 279 | m_Children: [] 280 | m_Father: {fileID: 0} 281 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 282 | --- !u!114 &558177093 283 | MonoBehaviour: 284 | m_ObjectHideFlags: 0 285 | m_CorrespondingSourceObject: {fileID: 0} 286 | m_PrefabInstance: {fileID: 0} 287 | m_PrefabAsset: {fileID: 0} 288 | m_GameObject: {fileID: 558177090} 289 | m_Enabled: 1 290 | m_EditorHideFlags: 0 291 | m_Script: {fileID: 11500000, guid: 5fe7f10cc6d18084d9b4eba9b0c5b1b6, type: 3} 292 | m_Name: 293 | m_EditorClassIdentifier: 294 | addPhotoBtn: {fileID: 558177091} 295 | --- !u!1 &657332499 296 | GameObject: 297 | m_ObjectHideFlags: 0 298 | m_CorrespondingSourceObject: {fileID: 0} 299 | m_PrefabInstance: {fileID: 0} 300 | m_PrefabAsset: {fileID: 0} 301 | serializedVersion: 6 302 | m_Component: 303 | - component: {fileID: 657332501} 304 | - component: {fileID: 657332500} 305 | m_Layer: 0 306 | m_Name: Directional Light 307 | m_TagString: Untagged 308 | m_Icon: {fileID: 0} 309 | m_NavMeshLayer: 0 310 | m_StaticEditorFlags: 0 311 | m_IsActive: 1 312 | --- !u!108 &657332500 313 | Light: 314 | m_ObjectHideFlags: 0 315 | m_CorrespondingSourceObject: {fileID: 0} 316 | m_PrefabInstance: {fileID: 0} 317 | m_PrefabAsset: {fileID: 0} 318 | m_GameObject: {fileID: 657332499} 319 | m_Enabled: 1 320 | serializedVersion: 10 321 | m_Type: 1 322 | m_Shape: 0 323 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 324 | m_Intensity: 1 325 | m_Range: 10 326 | m_SpotAngle: 30 327 | m_InnerSpotAngle: 21.80208 328 | m_CookieSize: 10 329 | m_Shadows: 330 | m_Type: 2 331 | m_Resolution: -1 332 | m_CustomResolution: -1 333 | m_Strength: 1 334 | m_Bias: 0.05 335 | m_NormalBias: 0.4 336 | m_NearPlane: 0.2 337 | m_CullingMatrixOverride: 338 | e00: 1 339 | e01: 0 340 | e02: 0 341 | e03: 0 342 | e10: 0 343 | e11: 1 344 | e12: 0 345 | e13: 0 346 | e20: 0 347 | e21: 0 348 | e22: 1 349 | e23: 0 350 | e30: 0 351 | e31: 0 352 | e32: 0 353 | e33: 1 354 | m_UseCullingMatrixOverride: 0 355 | m_Cookie: {fileID: 0} 356 | m_DrawHalo: 0 357 | m_Flare: {fileID: 0} 358 | m_RenderMode: 0 359 | m_CullingMask: 360 | serializedVersion: 2 361 | m_Bits: 4294967295 362 | m_RenderingLayerMask: 1 363 | m_Lightmapping: 4 364 | m_LightShadowCasterMode: 0 365 | m_AreaSize: {x: 1, y: 1} 366 | m_BounceIntensity: 1 367 | m_ColorTemperature: 6570 368 | m_UseColorTemperature: 0 369 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 370 | m_UseBoundingSphereOverride: 0 371 | m_UseViewFrustumForShadowCasterCull: 1 372 | m_ShadowRadius: 0 373 | m_ShadowAngle: 0 374 | --- !u!4 &657332501 375 | Transform: 376 | m_ObjectHideFlags: 0 377 | m_CorrespondingSourceObject: {fileID: 0} 378 | m_PrefabInstance: {fileID: 0} 379 | m_PrefabAsset: {fileID: 0} 380 | m_GameObject: {fileID: 657332499} 381 | serializedVersion: 2 382 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 383 | m_LocalPosition: {x: 0, y: 3, z: 0} 384 | m_LocalScale: {x: 1, y: 1, z: 1} 385 | m_ConstrainProportionsScale: 0 386 | m_Children: [] 387 | m_Father: {fileID: 0} 388 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 389 | --- !u!1 &1219956220 390 | GameObject: 391 | m_ObjectHideFlags: 0 392 | m_CorrespondingSourceObject: {fileID: 0} 393 | m_PrefabInstance: {fileID: 0} 394 | m_PrefabAsset: {fileID: 0} 395 | serializedVersion: 6 396 | m_Component: 397 | - component: {fileID: 1219956222} 398 | - component: {fileID: 1219956223} 399 | - component: {fileID: 1219956221} 400 | m_Layer: 0 401 | m_Name: btn3 402 | m_TagString: Untagged 403 | m_Icon: {fileID: 0} 404 | m_NavMeshLayer: 0 405 | m_StaticEditorFlags: 0 406 | m_IsActive: 1 407 | --- !u!114 &1219956221 408 | MonoBehaviour: 409 | m_ObjectHideFlags: 0 410 | m_CorrespondingSourceObject: {fileID: 0} 411 | m_PrefabInstance: {fileID: 0} 412 | m_PrefabAsset: {fileID: 0} 413 | m_GameObject: {fileID: 1219956220} 414 | m_Enabled: 1 415 | m_EditorHideFlags: 0 416 | m_Script: {fileID: 11500000, guid: 3fc2fd0089a67bb45a031683c988bdfc, type: 3} 417 | m_Name: 418 | m_EditorClassIdentifier: 419 | _linkingMode: 3 420 | _guid: 31e8d3a6345f4563af32ccf8fb4b7e0e 421 | _guids: [] 422 | _name: 423 | _names: [] 424 | _uiDocument: {fileID: 1739256324} 425 | _debug: 0 426 | _onClick: 427 | m_PersistentCalls: 428 | m_Calls: 429 | - m_Target: {fileID: 1219956223} 430 | m_TargetAssemblyTypeName: DA_Assets.UEL.UelExample, Assembly-CSharp 431 | m_MethodName: AddPhoto_OnClick 432 | m_Mode: 1 433 | m_Arguments: 434 | m_ObjectArgument: {fileID: 0} 435 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 436 | m_IntArgument: 0 437 | m_FloatArgument: 0 438 | m_StringArgument: 439 | m_BoolArgument: 0 440 | m_CallState: 2 441 | --- !u!4 &1219956222 442 | Transform: 443 | m_ObjectHideFlags: 0 444 | m_CorrespondingSourceObject: {fileID: 0} 445 | m_PrefabInstance: {fileID: 0} 446 | m_PrefabAsset: {fileID: 0} 447 | m_GameObject: {fileID: 1219956220} 448 | serializedVersion: 2 449 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 450 | m_LocalPosition: {x: 0, y: 0, z: 0} 451 | m_LocalScale: {x: 1, y: 1, z: 1} 452 | m_ConstrainProportionsScale: 0 453 | m_Children: [] 454 | m_Father: {fileID: 0} 455 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 456 | --- !u!114 &1219956223 457 | MonoBehaviour: 458 | m_ObjectHideFlags: 0 459 | m_CorrespondingSourceObject: {fileID: 0} 460 | m_PrefabInstance: {fileID: 0} 461 | m_PrefabAsset: {fileID: 0} 462 | m_GameObject: {fileID: 1219956220} 463 | m_Enabled: 1 464 | m_EditorHideFlags: 0 465 | m_Script: {fileID: 11500000, guid: 5fe7f10cc6d18084d9b4eba9b0c5b1b6, type: 3} 466 | m_Name: 467 | m_EditorClassIdentifier: 468 | addPhotoBtn: {fileID: 1219956221} 469 | --- !u!1 &1606157395 470 | GameObject: 471 | m_ObjectHideFlags: 0 472 | m_CorrespondingSourceObject: {fileID: 0} 473 | m_PrefabInstance: {fileID: 0} 474 | m_PrefabAsset: {fileID: 0} 475 | serializedVersion: 6 476 | m_Component: 477 | - component: {fileID: 1606157397} 478 | - component: {fileID: 1606157398} 479 | - component: {fileID: 1606157396} 480 | m_Layer: 0 481 | m_Name: btn2 482 | m_TagString: Untagged 483 | m_Icon: {fileID: 0} 484 | m_NavMeshLayer: 0 485 | m_StaticEditorFlags: 0 486 | m_IsActive: 1 487 | --- !u!114 &1606157396 488 | MonoBehaviour: 489 | m_ObjectHideFlags: 0 490 | m_CorrespondingSourceObject: {fileID: 0} 491 | m_PrefabInstance: {fileID: 0} 492 | m_PrefabAsset: {fileID: 0} 493 | m_GameObject: {fileID: 1606157395} 494 | m_Enabled: 1 495 | m_EditorHideFlags: 0 496 | m_Script: {fileID: 11500000, guid: 3fc2fd0089a67bb45a031683c988bdfc, type: 3} 497 | m_Name: 498 | m_EditorClassIdentifier: 499 | _linkingMode: 4 500 | _guid: 501 | _guids: 502 | - 5c3a3a122e654af7a349189ae2038771 503 | - 92f00728d29540ab98223c54348d2cbd 504 | - 9c7f1231e0aa438687d8804d63053783 505 | _name: 506 | _names: [] 507 | _uiDocument: {fileID: 1739256324} 508 | _debug: 0 509 | _onClick: 510 | m_PersistentCalls: 511 | m_Calls: 512 | - m_Target: {fileID: 1606157398} 513 | m_TargetAssemblyTypeName: DA_Assets.UEL.UelExample, Assembly-CSharp 514 | m_MethodName: AddPhoto_OnClick 515 | m_Mode: 1 516 | m_Arguments: 517 | m_ObjectArgument: {fileID: 0} 518 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 519 | m_IntArgument: 0 520 | m_FloatArgument: 0 521 | m_StringArgument: 522 | m_BoolArgument: 0 523 | m_CallState: 2 524 | --- !u!4 &1606157397 525 | Transform: 526 | m_ObjectHideFlags: 0 527 | m_CorrespondingSourceObject: {fileID: 0} 528 | m_PrefabInstance: {fileID: 0} 529 | m_PrefabAsset: {fileID: 0} 530 | m_GameObject: {fileID: 1606157395} 531 | serializedVersion: 2 532 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 533 | m_LocalPosition: {x: 0, y: 0, z: 0} 534 | m_LocalScale: {x: 1, y: 1, z: 1} 535 | m_ConstrainProportionsScale: 0 536 | m_Children: [] 537 | m_Father: {fileID: 0} 538 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 539 | --- !u!114 &1606157398 540 | MonoBehaviour: 541 | m_ObjectHideFlags: 0 542 | m_CorrespondingSourceObject: {fileID: 0} 543 | m_PrefabInstance: {fileID: 0} 544 | m_PrefabAsset: {fileID: 0} 545 | m_GameObject: {fileID: 1606157395} 546 | m_Enabled: 1 547 | m_EditorHideFlags: 0 548 | m_Script: {fileID: 11500000, guid: 5fe7f10cc6d18084d9b4eba9b0c5b1b6, type: 3} 549 | m_Name: 550 | m_EditorClassIdentifier: 551 | addPhotoBtn: {fileID: 1606157396} 552 | --- !u!1 &1638721708 553 | GameObject: 554 | m_ObjectHideFlags: 0 555 | m_CorrespondingSourceObject: {fileID: 0} 556 | m_PrefabInstance: {fileID: 0} 557 | m_PrefabAsset: {fileID: 0} 558 | serializedVersion: 6 559 | m_Component: 560 | - component: {fileID: 1638721711} 561 | - component: {fileID: 1638721710} 562 | - component: {fileID: 1638721709} 563 | m_Layer: 0 564 | m_Name: Main Camera 565 | m_TagString: MainCamera 566 | m_Icon: {fileID: 0} 567 | m_NavMeshLayer: 0 568 | m_StaticEditorFlags: 0 569 | m_IsActive: 1 570 | --- !u!81 &1638721709 571 | AudioListener: 572 | m_ObjectHideFlags: 0 573 | m_CorrespondingSourceObject: {fileID: 0} 574 | m_PrefabInstance: {fileID: 0} 575 | m_PrefabAsset: {fileID: 0} 576 | m_GameObject: {fileID: 1638721708} 577 | m_Enabled: 1 578 | --- !u!20 &1638721710 579 | Camera: 580 | m_ObjectHideFlags: 0 581 | m_CorrespondingSourceObject: {fileID: 0} 582 | m_PrefabInstance: {fileID: 0} 583 | m_PrefabAsset: {fileID: 0} 584 | m_GameObject: {fileID: 1638721708} 585 | m_Enabled: 1 586 | serializedVersion: 2 587 | m_ClearFlags: 1 588 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 589 | m_projectionMatrixMode: 1 590 | m_GateFitMode: 2 591 | m_FOVAxisMode: 0 592 | m_Iso: 200 593 | m_ShutterSpeed: 0.005 594 | m_Aperture: 16 595 | m_FocusDistance: 10 596 | m_FocalLength: 50 597 | m_BladeCount: 5 598 | m_Curvature: {x: 2, y: 11} 599 | m_BarrelClipping: 0.25 600 | m_Anamorphism: 0 601 | m_SensorSize: {x: 36, y: 24} 602 | m_LensShift: {x: 0, y: 0} 603 | m_NormalizedViewPortRect: 604 | serializedVersion: 2 605 | x: 0 606 | y: 0 607 | width: 1 608 | height: 1 609 | near clip plane: 0.3 610 | far clip plane: 1000 611 | field of view: 60 612 | orthographic: 0 613 | orthographic size: 5 614 | m_Depth: -1 615 | m_CullingMask: 616 | serializedVersion: 2 617 | m_Bits: 4294967295 618 | m_RenderingPath: -1 619 | m_TargetTexture: {fileID: 0} 620 | m_TargetDisplay: 0 621 | m_TargetEye: 3 622 | m_HDR: 1 623 | m_AllowMSAA: 1 624 | m_AllowDynamicResolution: 0 625 | m_ForceIntoRT: 0 626 | m_OcclusionCulling: 1 627 | m_StereoConvergence: 10 628 | m_StereoSeparation: 0.022 629 | --- !u!4 &1638721711 630 | Transform: 631 | m_ObjectHideFlags: 0 632 | m_CorrespondingSourceObject: {fileID: 0} 633 | m_PrefabInstance: {fileID: 0} 634 | m_PrefabAsset: {fileID: 0} 635 | m_GameObject: {fileID: 1638721708} 636 | serializedVersion: 2 637 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 638 | m_LocalPosition: {x: 0, y: 1, z: -10} 639 | m_LocalScale: {x: 1, y: 1, z: 1} 640 | m_ConstrainProportionsScale: 0 641 | m_Children: [] 642 | m_Father: {fileID: 0} 643 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 644 | --- !u!1 &1739256323 645 | GameObject: 646 | m_ObjectHideFlags: 0 647 | m_CorrespondingSourceObject: {fileID: 0} 648 | m_PrefabInstance: {fileID: 0} 649 | m_PrefabAsset: {fileID: 0} 650 | serializedVersion: 6 651 | m_Component: 652 | - component: {fileID: 1739256325} 653 | - component: {fileID: 1739256324} 654 | m_Layer: 0 655 | m_Name: UIDocument 656 | m_TagString: Untagged 657 | m_Icon: {fileID: 0} 658 | m_NavMeshLayer: 0 659 | m_StaticEditorFlags: 0 660 | m_IsActive: 1 661 | --- !u!114 &1739256324 662 | MonoBehaviour: 663 | m_ObjectHideFlags: 0 664 | m_CorrespondingSourceObject: {fileID: 0} 665 | m_PrefabInstance: {fileID: 0} 666 | m_PrefabAsset: {fileID: 0} 667 | m_GameObject: {fileID: 1739256323} 668 | m_Enabled: 1 669 | m_EditorHideFlags: 0 670 | m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0} 671 | m_Name: 672 | m_EditorClassIdentifier: 673 | m_PanelSettings: {fileID: 11400000, guid: dcea92c3c04e77f419865340c36841bf, type: 2} 674 | m_ParentUI: {fileID: 0} 675 | sourceAsset: {fileID: 9197481963319205126, guid: b702558a8530a2548a76d19326445a84, type: 3} 676 | m_SortingOrder: 0 677 | --- !u!4 &1739256325 678 | Transform: 679 | m_ObjectHideFlags: 0 680 | m_CorrespondingSourceObject: {fileID: 0} 681 | m_PrefabInstance: {fileID: 0} 682 | m_PrefabAsset: {fileID: 0} 683 | m_GameObject: {fileID: 1739256323} 684 | serializedVersion: 2 685 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 686 | m_LocalPosition: {x: 0, y: 0, z: 0} 687 | m_LocalScale: {x: 1, y: 1, z: 1} 688 | m_ConstrainProportionsScale: 0 689 | m_Children: [] 690 | m_Father: {fileID: 0} 691 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 692 | --- !u!1660057539 &9223372036854775807 693 | SceneRoots: 694 | m_ObjectHideFlags: 0 695 | m_Roots: 696 | - {fileID: 1638721711} 697 | - {fileID: 657332501} 698 | - {fileID: 1739256325} 699 | - {fileID: 22818355} 700 | - {fileID: 1606157397} 701 | - {fileID: 1219956222} 702 | - {fileID: 558177092} 703 | -------------------------------------------------------------------------------- /Examples/Example Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59f8501c30028a149bb489200be37ca1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Examples/ExampleUXMLTemplate.uxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Examples/ExampleUXMLTemplate.uxml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b702558a8530a2548a76d19326445a84 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} 11 | -------------------------------------------------------------------------------- /Examples/New Panel Settings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: New Panel Settings 14 | m_EditorClassIdentifier: 15 | themeUss: {fileID: -4733365628477956816, guid: c1ea9284ef9d8bb4b93f2086eb5b3c40, type: 3} 16 | m_DisableNoThemeWarning: 0 17 | m_TargetTexture: {fileID: 0} 18 | m_RenderMode: 0 19 | m_WorldSpaceLayer: 0 20 | m_ScaleMode: 1 21 | m_ReferenceSpritePixelsPerUnit: 100 22 | m_PixelsPerUnit: 100 23 | m_Scale: 1 24 | m_ReferenceDpi: 96 25 | m_FallbackDpi: 96 26 | m_ReferenceResolution: {x: 1200, y: 800} 27 | m_ScreenMatchMode: 0 28 | m_Match: 0 29 | m_SortingOrder: 0 30 | m_TargetDisplay: 0 31 | m_BindingLogLevel: 0 32 | m_ClearDepthStencil: 1 33 | m_ClearColor: 0 34 | m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0} 35 | m_VertexBudget: 0 36 | m_DynamicAtlasSettings: 37 | m_MinAtlasSize: 64 38 | m_MaxAtlasSize: 4096 39 | m_MaxSubTextureSize: 64 40 | m_ActiveFilters: -1 41 | m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0} 42 | m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0} 43 | m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0} 44 | m_ICUDataAsset: {fileID: 0} 45 | forceGammaRendering: 0 46 | textSettings: {fileID: 0} 47 | -------------------------------------------------------------------------------- /Examples/New Panel Settings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 916107fa72d7fc34b96c7a0c102b4889 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Examples/UelExample.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_2021_3_OR_NEWER 2 | using UnityEngine; 3 | 4 | namespace DA_Assets.UEL 5 | { 6 | public class UelExample : MonoBehaviour 7 | { 8 | [SerializeField] UitkButton addPhotoBtn; 9 | 10 | private void Start() 11 | { 12 | //Access to your UITK element. 13 | UnityEngine.UIElements.Button btn = addPhotoBtn.E; 14 | Debug.Log(btn.name); 15 | } 16 | 17 | //You don't need to use 'RegisterCallback'. 18 | public void AddPhoto_OnClick() 19 | { 20 | Debug.Log($"{addPhotoBtn.E.name} clicked!"); 21 | } 22 | } 23 | } 24 | #endif -------------------------------------------------------------------------------- /Examples/UelExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fe7f10cc6d18084d9b4eba9b0c5b1b6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 D.A. Assets 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26eb14a52e7eadf4cb0c8719e55f7312 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![Logo](https://da-assets.github.io/site/files/uel/repos/cover2.png) 3 | 4 | ![App Screenshot](https://da-assets.github.io/site/files/uel/repos/promo1_2.png) 5 | 6 | ![App Screenshot](https://da-assets.github.io/site/files/uel/repos/promo2_2.png) 7 | 8 | 9 | The asset allows you to easily set up linking between your UI Toolkit elements and MonoBehaviour scripts, without the need to use the "Query" method. 10 | 11 | The asset supports 2 ways of element linking: 12 | 13 | 1. Using GUID. In this case, you need to use a new set of visual elements inherited from the original UI Builder visual elements. 14 | These elements have a new field - GUID, which contains a unique auto-generated identifier that is used for element lookup. 15 | 16 | 2. Using the element name and/or hierarchy index. 17 | You can specify just the name, or set a hierarchy of indexes and names, by which your element will be searched in the UI Builder layout. 18 | 19 | Once you have chosen the linking method that suits you, you can easily access your element using a special component. 20 | 21 | More information can be found in the manual attached to the asset and on the developer's website. 22 | ## Contributing 23 | 24 | Contributions are always welcome! 25 | 26 | 27 | ## Manual 28 | 29 | [Open the manual](https://da-assets.github.io/site/files/uel/UEL%20-%20Manual%20for%20developers.pdf) 30 | ## License 31 | 32 | [MIT](https://choosealicense.com/licenses/mit/) 33 | 34 | 35 | ## Support 36 | 37 | Asset Store: https://assetstore.unity.com/packages/tools/gui/282751 38 | 39 | Discord Server: https://discord.com/invite/ZsnDffV5eE 40 | 41 | Telegram Group: - 42 | 43 | Telegram Support: https://t.me/da_assets 44 | 45 | Email Support: da.assets.publisher@gmail.com 46 | 47 | Website: https://da-assets.github.io/site/ -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69332a3286b81094281c9259972eacce 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d161229487aa1444dbd777cb0c1577fc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/DA_Assets.UEL.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DA_Assets.UEL", 3 | "rootNamespace": "DA_Assets.UEL", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Runtime/DA_Assets.UEL.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18f4a329dd82a544b9708a339d2ef8c9 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4179fe3a83ef060479c43d3e573940df 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Scripts/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e6a42a48a0c2dc4194ab8710cd131c4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBoundsField.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_2022_1_OR_NEWER 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace DA_Assets.UEL 6 | { 7 | public class UitkBoundsField : UitkLinker { } 8 | 9 | #if UNITY_6000_0_OR_NEWER 10 | [UxmlElement(nameof(BoundsFieldG))] 11 | public partial class BoundsFieldG : UnityEngine.UIElements.BoundsField, IHaveGuid 12 | { 13 | [UxmlAttribute] 14 | public string guid { get; set; } 15 | 16 | public BoundsFieldG() 17 | { 18 | guid = GuidGenerator.GenerateGuid(guid); 19 | } 20 | } 21 | #else 22 | public class BoundsFieldG : UnityEngine.UIElements.BoundsField, IHaveGuid 23 | { 24 | public string guid { get; set; } 25 | 26 | public new class UxmlFactory : UxmlFactory { } 27 | 28 | public new class UxmlTraits : BaseField.UxmlTraits 29 | { 30 | UxmlStringAttributeDescription m_Guid = GuidGenerator.GetGuidField(); 31 | 32 | private UxmlFloatAttributeDescription m_CenterXValue = new UxmlFloatAttributeDescription 33 | { 34 | name = "cx" 35 | }; 36 | 37 | private UxmlFloatAttributeDescription m_CenterYValue = new UxmlFloatAttributeDescription 38 | { 39 | name = "cy" 40 | }; 41 | 42 | private UxmlFloatAttributeDescription m_CenterZValue = new UxmlFloatAttributeDescription 43 | { 44 | name = "cz" 45 | }; 46 | 47 | private UxmlFloatAttributeDescription m_ExtentsXValue = new UxmlFloatAttributeDescription 48 | { 49 | name = "ex" 50 | }; 51 | 52 | private UxmlFloatAttributeDescription m_ExtentsYValue = new UxmlFloatAttributeDescription 53 | { 54 | name = "ey" 55 | }; 56 | 57 | private UxmlFloatAttributeDescription m_ExtentsZValue = new UxmlFloatAttributeDescription 58 | { 59 | name = "ez" 60 | }; 61 | 62 | public override void Init(UnityEngine.UIElements.VisualElement ve, IUxmlAttributes bag, CreationContext cc) 63 | { 64 | base.Init(ve, bag, cc); 65 | BoundsFieldG boundsField = (BoundsFieldG)ve; 66 | boundsField.SetValueWithoutNotify(new Bounds(new Vector3(m_CenterXValue.GetValueFromBag(bag, cc), m_CenterYValue.GetValueFromBag(bag, cc), m_CenterZValue.GetValueFromBag(bag, cc)), new Vector3(m_ExtentsXValue.GetValueFromBag(bag, cc), m_ExtentsYValue.GetValueFromBag(bag, cc), m_ExtentsZValue.GetValueFromBag(bag, cc)))); 67 | 68 | BoundsFieldG obj = ve as BoundsFieldG; 69 | GuidGenerator.GenerateGuid(m_Guid, obj, bag, cc); 70 | } 71 | } 72 | } 73 | #endif 74 | } 75 | #endif -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBoundsField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be4aa95546793ca449f2411da992ef6a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBoundsIntField.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_2022_1_OR_NEWER 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace DA_Assets.UEL 6 | { 7 | public class UitkBoundsIntField : UitkLinker { } 8 | 9 | #if UNITY_6000_0_OR_NEWER 10 | [UxmlElement(nameof(BoundsIntFieldG))] 11 | public partial class BoundsIntFieldG : UnityEngine.UIElements.BoundsIntField, IHaveGuid 12 | { 13 | [UxmlAttribute] 14 | public string guid { get; set; } 15 | 16 | public BoundsIntFieldG() 17 | { 18 | guid = GuidGenerator.GenerateGuid(guid); 19 | } 20 | } 21 | #else 22 | public class BoundsIntFieldG : UnityEngine.UIElements.BoundsIntField, IHaveGuid 23 | { 24 | public string guid { get; set; } 25 | 26 | public new class UxmlFactory : UxmlFactory { } 27 | 28 | public new class UxmlTraits : BaseField.UxmlTraits 29 | { 30 | UxmlStringAttributeDescription m_Guid = GuidGenerator.GetGuidField(); 31 | 32 | private UxmlIntAttributeDescription m_PositionXValue = new UxmlIntAttributeDescription 33 | { 34 | name = "px" 35 | }; 36 | 37 | private UxmlIntAttributeDescription m_PositionYValue = new UxmlIntAttributeDescription 38 | { 39 | name = "py" 40 | }; 41 | 42 | private UxmlIntAttributeDescription m_PositionZValue = new UxmlIntAttributeDescription 43 | { 44 | name = "pz" 45 | }; 46 | 47 | private UxmlIntAttributeDescription m_SizeXValue = new UxmlIntAttributeDescription 48 | { 49 | name = "sx" 50 | }; 51 | 52 | private UxmlIntAttributeDescription m_SizeYValue = new UxmlIntAttributeDescription 53 | { 54 | name = "sy" 55 | }; 56 | 57 | private UxmlIntAttributeDescription m_SizeZValue = new UxmlIntAttributeDescription 58 | { 59 | name = "sz" 60 | }; 61 | 62 | public override void Init(UnityEngine.UIElements.VisualElement ve, IUxmlAttributes bag, CreationContext cc) 63 | { 64 | base.Init(ve, bag, cc); 65 | BoundsIntFieldG boundsIntField = (BoundsIntFieldG)ve; 66 | boundsIntField.SetValueWithoutNotify(new BoundsInt(new Vector3Int(m_PositionXValue.GetValueFromBag(bag, cc), m_PositionYValue.GetValueFromBag(bag, cc), m_PositionZValue.GetValueFromBag(bag, cc)), new Vector3Int(m_SizeXValue.GetValueFromBag(bag, cc), m_SizeYValue.GetValueFromBag(bag, cc), m_SizeZValue.GetValueFromBag(bag, cc)))); 67 | 68 | BoundsIntFieldG obj = ve as BoundsIntFieldG; 69 | GuidGenerator.GenerateGuid(m_Guid, obj, bag, cc); 70 | } 71 | } 72 | } 73 | #endif 74 | } 75 | #endif -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBoundsIntField.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb35f6747a7851e4181abf9f6d99412e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBox.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.UIElements; 2 | 3 | namespace DA_Assets.UEL 4 | { 5 | public class UitkBox : UitkLinker { } 6 | 7 | #if UNITY_6000_0_OR_NEWER 8 | [UxmlElement(nameof(BoxG))] 9 | public partial class BoxG : UnityEngine.UIElements.Box, IHaveGuid 10 | { 11 | [UxmlAttribute] 12 | public string guid { get; set; } 13 | 14 | public BoxG() 15 | { 16 | guid = GuidGenerator.GenerateGuid(guid); 17 | } 18 | } 19 | #else 20 | public class BoxG : UnityEngine.UIElements.Box, IHaveGuid 21 | { 22 | public string guid { get; set; } 23 | 24 | public new class UxmlFactory : UxmlFactory { } 25 | 26 | public new class UxmlTraits : UnityEngine.UIElements.Box.UxmlTraits 27 | { 28 | UxmlStringAttributeDescription m_Guid = GuidGenerator.GetGuidField(); 29 | 30 | public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) 31 | { 32 | base.Init(ve, bag, cc); 33 | 34 | BoxG obj = ve as BoxG; 35 | GuidGenerator.GenerateGuid(m_Guid, obj, bag, cc); 36 | } 37 | } 38 | } 39 | #endif 40 | } -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkBox.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8eed0623b5a0c5946a5c4dc3c076f766 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Scripts/Components/UitkButton.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_2021_3_OR_NEWER 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | using UnityEngine.UIElements; 5 | 6 | namespace DA_Assets.UEL 7 | { 8 | public class UitkButton : UitkLinker