├── .gitattributes ├── .gitignore ├── Editor.meta ├── Editor ├── DA_Assets.ULB.Editor.asmdef ├── DA_Assets.ULB.Editor.asmdef.meta ├── Scripts.meta └── Scripts │ ├── ContextMenuItems.cs │ ├── ContextMenuItems.cs.meta │ ├── ElementIndexNameSerializator.cs │ ├── ElementIndexNameSerializator.cs.meta │ ├── JsonSerializerInternal.cs │ ├── JsonSerializerInternal.cs.meta │ ├── MemberBindingDrawer.cs │ ├── MemberBindingDrawer.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 ├── Manual.txt ├── Manual.txt.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── DA_Assets.ULB.asmdef ├── DA_Assets.ULB.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 │ ├── Enums.cs │ ├── Enums.cs.meta │ ├── GuidGenerator.cs │ ├── GuidGenerator.cs.meta │ ├── MemberBinding.cs │ ├── MemberBinding.cs.meta │ ├── Structs.cs │ ├── Structs.cs.meta │ ├── UitkBindingSettings.cs │ ├── UitkBindingSettings.cs.meta │ ├── UitkConstants.cs │ ├── UitkConstants.cs.meta │ ├── UitkLinker.cs │ ├── UitkLinker.cs.meta │ ├── UitkLinkerBase.cs │ ├── UitkLinkerBase.cs.meta │ ├── UitkLinkerWithBinding.cs │ ├── UitkLinkerWithBinding.cs.meta │ ├── UitkQueryExtensions.cs │ └── UitkQueryExtensions.cs.meta ├── Tests.meta ├── Tests ├── DA_Assets.ULB.Tests.asmdef ├── DA_Assets.ULB.Tests.asmdef.meta ├── Resources.meta ├── Resources │ ├── TestBindings.uxml │ ├── TestBindings.uxml.meta │ ├── TestPanelSettings.asset │ └── TestPanelSettings.asset.meta ├── Scripts.meta ├── Scripts │ ├── BinderTest.cs │ ├── BinderTest.cs.meta │ ├── ComponentCreator.cs │ ├── ComponentCreator.cs.meta │ ├── ManualTest.cs │ ├── ManualTest.cs.meta │ ├── ValueUpdater.cs │ └── ValueUpdater.cs.meta ├── Test.unity └── Test.unity.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.ULB.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DA_Assets.ULB.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.ULB.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.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.ULB; 2 | using System.Collections.Generic; 3 | 4 | namespace DA_Assets.ULB 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.ULB 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/MemberBindingDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3180d47ee4413ad4fa354127adca5bf3 -------------------------------------------------------------------------------- /Editor/Scripts/ScriptGeneratorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.IO; 4 | 5 | namespace DA_Assets.ULB 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 UnityEditor.UIElements; 4 | using UnityEngine; 5 | using UnityEngine.UIElements; 6 | 7 | namespace DA_Assets.ULB 8 | { 9 | [CustomEditor(typeof(UitkLinkerBase), true), CanEditMultipleObjects] 10 | public class UitkLinkerEditor : Editor 11 | { 12 | public override VisualElement CreateInspectorGUI() 13 | { 14 | // Create the root VisualElement 15 | var root = new VisualElement(); 16 | 17 | // Bind the serializedObject to automatically update properties 18 | root.Bind(serializedObject); 19 | 20 | // Standard fields that are always visible 21 | var uiDocumentField = new PropertyField(serializedObject.FindProperty("_uiDocument")); 22 | var linkingModeField = new PropertyField(serializedObject.FindProperty("_linkingMode")); 23 | 24 | root.Add(uiDocumentField); 25 | root.Add(linkingModeField); 26 | 27 | #region Linking Mode Fields 28 | // Create a container for the fields that depend on the linking mode 29 | var linkingFieldsContainer = new VisualElement 30 | { 31 | name = "linking-fields-container", 32 | style = { marginTop = 5 } 33 | }; 34 | 35 | var nameField = new PropertyField(serializedObject.FindProperty("_name"), "Name"); 36 | var namesField = new PropertyField(serializedObject.FindProperty("_names"), "Names"); 37 | var guidField = new PropertyField(serializedObject.FindProperty("_guid"), "Guid"); 38 | var guidsField = new PropertyField(serializedObject.FindProperty("_guids"), "Guids"); 39 | 40 | linkingFieldsContainer.Add(nameField); 41 | linkingFieldsContainer.Add(namesField); 42 | linkingFieldsContainer.Add(guidField); 43 | linkingFieldsContainer.Add(guidsField); 44 | root.Add(linkingFieldsContainer); 45 | 46 | // Function to update visibility based on linking mode 47 | void UpdateLinkingFields(UitkLinkingMode mode) 48 | { 49 | nameField.style.display = (mode == UitkLinkingMode.Name) ? DisplayStyle.Flex : DisplayStyle.None; 50 | namesField.style.display = (mode == UitkLinkingMode.IndexNames) ? DisplayStyle.Flex : DisplayStyle.None; 51 | guidField.style.display = (mode == UitkLinkingMode.Guid) ? DisplayStyle.Flex : DisplayStyle.None; 52 | guidsField.style.display = (mode == UitkLinkingMode.Guids) ? DisplayStyle.Flex : DisplayStyle.None; 53 | } 54 | 55 | // Register a callback to update fields when the enum value changes 56 | linkingModeField.RegisterValueChangeCallback(evt => 57 | { 58 | UpdateLinkingFields((UitkLinkingMode)evt.changedProperty.enumValueIndex); 59 | }); 60 | 61 | // Set the initial state 62 | UpdateLinkingFields((UitkLinkingMode)serializedObject.FindProperty("_linkingMode").enumValueIndex); 63 | #endregion 64 | 65 | #region Binding Fields 66 | // Check if the target component supports binding 67 | if (IsBinder(target.GetType())) 68 | { 69 | var bindingEnabledToggle = new PropertyField(serializedObject.FindProperty("_bindingEnabled")); 70 | bindingEnabledToggle.style.marginTop = 10; 71 | 72 | var bindingDetailsContainer = new VisualElement 73 | { 74 | name = "binding-details-container", 75 | style = { marginLeft = 10, marginTop = 5 } // Indent binding details 76 | }; 77 | 78 | var bindingRateField = new PropertyField(serializedObject.FindProperty("_bindingRateMs")); 79 | var bindingSettingsField = new PropertyField(serializedObject.FindProperty("_bindingSettings")); 80 | var bindingField = new PropertyField(serializedObject.FindProperty("_binding")); 81 | 82 | bindingDetailsContainer.Add(bindingRateField); 83 | bindingDetailsContainer.Add(bindingSettingsField); 84 | bindingDetailsContainer.Add(bindingField); 85 | 86 | root.Add(bindingEnabledToggle); 87 | root.Add(bindingDetailsContainer); 88 | 89 | // Function to update visibility of binding details 90 | void UpdateBindingFields(bool isEnabled) 91 | { 92 | bindingDetailsContainer.style.display = isEnabled ? DisplayStyle.Flex : DisplayStyle.None; 93 | } 94 | 95 | // Register callback for the toggle 96 | bindingEnabledToggle.RegisterValueChangeCallback(evt => 97 | { 98 | UpdateBindingFields(evt.changedProperty.boolValue); 99 | }); 100 | 101 | // Set initial state for binding details 102 | UpdateBindingFields(serializedObject.FindProperty("_bindingEnabled").boolValue); 103 | } 104 | #endregion 105 | 106 | // Add the debug field at the end 107 | var debugField = new PropertyField(serializedObject.FindProperty("_debug")); 108 | debugField.style.marginTop = 10; 109 | root.Add(debugField); 110 | 111 | return root; 112 | } 113 | 114 | /// 115 | /// Checks if the specified type inherits from the generic UitkLinker<,> for data binding. 116 | /// 117 | private bool IsBinder(Type type) 118 | { 119 | if (type == null || type == typeof(object)) 120 | { 121 | return false; 122 | } 123 | 124 | Type currentType = type; 125 | while (currentType != null) 126 | { 127 | if (currentType.IsGenericType && currentType.GetGenericTypeDefinition() == typeof(UitkLinker<,>)) 128 | { 129 | return true; 130 | } 131 | currentType = currentType.BaseType; 132 | } 133 | 134 | return false; 135 | } 136 | } 137 | 138 | [CustomPropertyDrawer(typeof(ElementIndexName))] 139 | public class ElementIndexNameDrawer : PropertyDrawer 140 | { 141 | static readonly ElementIndexName def = default; 142 | 143 | const int padding = 2; 144 | const float spacing = 10; 145 | const float indexFieldWidth = 30; 146 | const float labelWidth = 50; 147 | 148 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 149 | { 150 | EditorGUI.BeginProperty(position, label, property); 151 | EditorGUI.BeginChangeCheck(); 152 | 153 | int indent = EditorGUI.indentLevel; 154 | EditorGUI.indentLevel = 0; 155 | 156 | EditorGUIUtility.labelWidth = labelWidth; 157 | 158 | string indexName = nameof(def.Index); 159 | string nameName = nameof(def.Name); 160 | 161 | Rect indexRect = new Rect(position.x, position.y, indexFieldWidth + labelWidth, position.height); 162 | EditorGUI.PropertyField(indexRect, property.FindPropertyRelative(indexName), new GUIContent(indexName)); 163 | 164 | float nameFieldWidth = position.width - indexFieldWidth - labelWidth - padding - spacing; 165 | 166 | Rect nameRect = new Rect(position.x + indexFieldWidth + labelWidth + padding + spacing, position.y, nameFieldWidth, position.height); 167 | EditorGUI.PropertyField(nameRect, property.FindPropertyRelative(nameName), new GUIContent(nameName)); 168 | 169 | EditorGUIUtility.labelWidth = 0; 170 | EditorGUI.indentLevel = indent; 171 | 172 | if (EditorGUI.EndChangeCheck()) 173 | property.serializedObject.ApplyModifiedProperties(); 174 | 175 | EditorGUI.EndProperty(); 176 | } 177 | } 178 | } -------------------------------------------------------------------------------- /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.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.ULB 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 | -------------------------------------------------------------------------------- /Manual.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DA-Assets/UI-Toolkit-Element-Linker/932422bccf3498e4d81cd01c569352359adca8a1/Manual.txt -------------------------------------------------------------------------------- /Manual.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9a53df12875e5548a34464bd3c7444f 3 | TextScriptImporter: 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.ULB.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DA_Assets.ULB", 3 | "rootNamespace": "DA_Assets.ULB", 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.ULB.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.ULB 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.ULB 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.ULB 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.ULB 7 | { 8 | public class UitkButton : UitkLinker