diff --git a/Assets/BetterEditorTools/Editor/BetterEditorTools.Editor.asmdef b/Assets/BetterEditorTools/Editor/BetterEditorTools.Editor.asmdef index 4d8a979..2a0dd1a 100644 --- a/Assets/BetterEditorTools/Editor/BetterEditorTools.Editor.asmdef +++ b/Assets/BetterEditorTools/Editor/BetterEditorTools.Editor.asmdef @@ -4,7 +4,8 @@ "references": [ "GUID:443314a5a4e67c14a88ae223776b6554", "GUID:28da8d3b12e3efa47928e0c9070f853d", - "GUID:a59e3daedde9ca94bba45364d4ead25f" + "GUID:a59e3daedde9ca94bba45364d4ead25f", + "GUID:01df13aca8d01e24a911bcc3e8277031" ], "includePlatforms": [ "Editor" diff --git a/Assets/BetterEditorTools/Editor/EditorTools/Attributes/MultiCustomPropertyDrawer.cs b/Assets/BetterEditorTools/Editor/EditorTools/Attributes/MultiCustomPropertyDrawer.cs index 2b7e357..b8501f1 100644 --- a/Assets/BetterEditorTools/Editor/EditorTools/Attributes/MultiCustomPropertyDrawer.cs +++ b/Assets/BetterEditorTools/Editor/EditorTools/Attributes/MultiCustomPropertyDrawer.cs @@ -1,10 +1,10 @@ using System; using System.Diagnostics; -using Better.Tools.Runtime; +using Better.Internal.Core.Runtime; namespace Better.EditorTools.Attributes { - [Conditional(BetterEditorDefines.Editor)] + [Conditional(Defines.Editor)] [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class MultiCustomPropertyDrawer : Attribute { diff --git a/Assets/BetterEditorTools/Editor/EditorTools/Drawers/MultiPropertyDrawer.cs b/Assets/BetterEditorTools/Editor/EditorTools/Drawers/MultiPropertyDrawer.cs index 800cd4b..73b0e8a 100644 --- a/Assets/BetterEditorTools/Editor/EditorTools/Drawers/MultiPropertyDrawer.cs +++ b/Assets/BetterEditorTools/Editor/EditorTools/Drawers/MultiPropertyDrawer.cs @@ -7,6 +7,7 @@ using Better.EditorTools.Comparers; using Better.EditorTools.Drawers.Base; using Better.Extensions.Runtime; +using Better.Internal.Core.Runtime; using Better.Tools.Runtime; using Better.Tools.Runtime.Attributes; using UnityEditor; @@ -98,7 +99,7 @@ private void TryInitialize() if (!_fieldDrawers.TryGetValue(propertyAttribute.GetType(), out var drawerType)) continue; param[1] = propertyAttribute; - var drawer = (FieldDrawer)Activator.CreateInstance(drawerType, BetterEditorDefines.ConstructorFlags, null, param, null); + var drawer = (FieldDrawer)Activator.CreateInstance(drawerType, Defines.ConstructorFlags, null, param, null); drawers.Add(drawer); } diff --git a/Assets/BetterEditorTools/Editor/EditorTools/Helpers/EditorGUIHelpers.cs b/Assets/BetterEditorTools/Editor/EditorTools/Helpers/EditorGUIHelpers.cs index e1a076a..f4df5e2 100644 --- a/Assets/BetterEditorTools/Editor/EditorTools/Helpers/EditorGUIHelpers.cs +++ b/Assets/BetterEditorTools/Editor/EditorTools/Helpers/EditorGUIHelpers.cs @@ -1,5 +1,5 @@ using System.Reflection; -using Better.Tools.Runtime; +using Better.Internal.Core.Runtime; using UnityEditor; using UnityEngine; @@ -13,7 +13,7 @@ public static bool PropertyFieldSafe(Rect position, SerializedProperty property, if (_defaultPropertyField == null) { var type = typeof(EditorGUI); - _defaultPropertyField = type.GetMethod("DefaultPropertyField", BetterEditorDefines.MethodFlags); + _defaultPropertyField = type.GetMethod("DefaultPropertyField", Defines.MethodFlags); } return (bool)_defaultPropertyField.Invoke(null, new object[] { position, property, label }); diff --git a/Assets/BetterEditorTools/Editor/EditorTools/Helpers/ReorderableListHelpers.cs b/Assets/BetterEditorTools/Editor/EditorTools/Helpers/ReorderableListHelpers.cs index 84d8652..07e5a5c 100644 --- a/Assets/BetterEditorTools/Editor/EditorTools/Helpers/ReorderableListHelpers.cs +++ b/Assets/BetterEditorTools/Editor/EditorTools/Helpers/ReorderableListHelpers.cs @@ -1,4 +1,4 @@ -using Better.Tools.Runtime; +using Better.Internal.Core.Runtime; using UnityEditor; using UnityEditorInternal; @@ -14,7 +14,7 @@ public static void RepaintAllInspectors(SerializedProperty property) if (_repaintInspectors == null) { var inspWin = typeof(ReorderableList); - _repaintInspectors = inspWin.GetMethod("InvalidateParentCaches", BetterEditorDefines.MethodFlags); + _repaintInspectors = inspWin.GetMethod("InvalidateParentCaches", Defines.MethodFlags); } if (_repaintInspectors != null) _repaintInspectors.Invoke(null, new object[] { property.propertyPath }); diff --git a/Assets/BetterEditorTools/Editor/EditorTools/SerializedPropertyExtensions.cs b/Assets/BetterEditorTools/Editor/EditorTools/SerializedPropertyExtensions.cs index 7996dc1..75cbba1 100644 --- a/Assets/BetterEditorTools/Editor/EditorTools/SerializedPropertyExtensions.cs +++ b/Assets/BetterEditorTools/Editor/EditorTools/SerializedPropertyExtensions.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; +using Better.Internal.Core.Runtime; using Better.Tools.Runtime; using UnityEditor; using UnityEngine; @@ -83,7 +84,7 @@ public static bool IsDisposed(this SerializedObject serializedObject) return true; } - var objectPrtInfo = typeof(SerializedObject).GetField("m_NativeObjectPtr", BetterEditorDefines.FieldsFlags); + var objectPrtInfo = typeof(SerializedObject).GetField("m_NativeObjectPtr", Defines.FieldsFlags); try { if (objectPrtInfo != null) @@ -107,8 +108,8 @@ public static bool IsDisposed(this SerializedProperty property) return true; } - var propertyPrtInfo = typeof(SerializedProperty).GetField("m_NativePropertyPtr", BetterEditorDefines.FieldsFlags); - var objectPrtInfo = typeof(SerializedObject).GetField("m_NativeObjectPtr", BetterEditorDefines.FieldsFlags); + var propertyPrtInfo = typeof(SerializedProperty).GetField("m_NativePropertyPtr", Defines.FieldsFlags); + var objectPrtInfo = typeof(SerializedObject).GetField("m_NativeObjectPtr", Defines.FieldsFlags); try { if (propertyPrtInfo != null && objectPrtInfo != null) @@ -133,7 +134,7 @@ public static bool Verify(this SerializedProperty property) return false; } - var verifyMethod = typeof(SerializedProperty).GetMethod("Verify", BetterEditorDefines.FieldsFlags); + var verifyMethod = typeof(SerializedProperty).GetMethod("Verify", Defines.FieldsFlags); try { @@ -380,13 +381,13 @@ private static List TraverseBaseClasses(Type currentType, string nam { var memberInfos = new List(); - var currentTypeFields = currentType.GetMember(name, BetterEditorDefines.FieldsFlags); + var currentTypeFields = currentType.GetMember(name, Defines.FieldsFlags); memberInfos.AddRange(currentTypeFields); var baseType = currentType.BaseType; if (baseType == null) return memberInfos; - var baseTypeFields = baseType.GetMember(name, BetterEditorDefines.FieldsFlags); + var baseTypeFields = baseType.GetMember(name, Defines.FieldsFlags); memberInfos.AddRange(baseTypeFields); memberInfos.AddRange(TraverseBaseClasses(baseType, name)); // Recursively traverse the base classes @@ -397,7 +398,7 @@ private static List TraverseBaseClasses(Type currentType, string nam private static void SetMemberValue(object container, string name, object value) { var type = container.GetType(); - var members = type.GetMember(name, BetterEditorDefines.FieldsFlags); + var members = type.GetMember(name, Defines.FieldsFlags); for (int i = 0; i < members.Length; ++i) { if (members[i] is FieldInfo field) diff --git a/Assets/BetterEditorTools/Editor/SettingsTools/ProjectSettingsTools.cs b/Assets/BetterEditorTools/Editor/SettingsTools/ProjectSettingsTools.cs index 63cf5cd..916d9dd 100644 --- a/Assets/BetterEditorTools/Editor/SettingsTools/ProjectSettingsTools.cs +++ b/Assets/BetterEditorTools/Editor/SettingsTools/ProjectSettingsTools.cs @@ -1,4 +1,5 @@ using System.IO; +using Better.Internal.Core.Runtime; using Better.Tools.Runtime; using Better.Tools.Runtime.Settings; using UnityEditor; @@ -16,17 +17,17 @@ public ProjectSettingsTools(string namespacePrefix, string settingMenuItem) { NamespacePrefix = namespacePrefix; _folderPaths = new string[] - { BetterEditorDefines.BetterPrefix, NamespacePrefix, BetterEditorDefines.ResourcesPrefix }; - var menuItemPrefix = $"{BetterEditorDefines.BetterPrefix}/{settingMenuItem}"; - ProjectSettingKey = $"{BetterEditorDefines.ProjectPrefix}/{menuItemPrefix}"; + { PrefixConstants.BetterPrefix, NamespacePrefix, PrefixConstants.ResourcesPrefix }; + var menuItemPrefix = $"{PrefixConstants.BetterPrefix}/{settingMenuItem}"; + ProjectSettingKey = $"{PrefixConstants.ProjectPrefix}/{menuItemPrefix}"; } public ProjectSettingsTools(string namespacePrefix, string settingMenuItem, string[] settingsFolderNames) { NamespacePrefix = namespacePrefix; _folderPaths = settingsFolderNames; - var menuItemPrefix = $"{BetterEditorDefines.BetterPrefix}/{settingMenuItem}"; - ProjectSettingKey = $"{BetterEditorDefines.ProjectPrefix}/{menuItemPrefix}"; + var menuItemPrefix = $"{PrefixConstants.BetterPrefix}/{settingMenuItem}"; + ProjectSettingKey = $"{PrefixConstants.ProjectPrefix}/{menuItemPrefix}"; } private string GenerateResourcesRelativePath() diff --git a/Assets/BetterEditorTools/Runtime/Attributes/MultiPropertyAttribute.cs b/Assets/BetterEditorTools/Runtime/Attributes/MultiPropertyAttribute.cs index 6f457f3..56aa3eb 100644 --- a/Assets/BetterEditorTools/Runtime/Attributes/MultiPropertyAttribute.cs +++ b/Assets/BetterEditorTools/Runtime/Attributes/MultiPropertyAttribute.cs @@ -1,10 +1,11 @@ using System; using System.Diagnostics; +using Better.Internal.Core.Runtime; using UnityEngine; namespace Better.Tools.Runtime.Attributes { - [Conditional(BetterEditorDefines.Editor)] + [Conditional(Defines.Editor)] [AttributeUsage(AttributeTargets.Field)] public abstract class MultiPropertyAttribute : PropertyAttribute { diff --git a/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs b/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs deleted file mode 100644 index 4b4b0e3..0000000 --- a/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using UnityEngine; - -namespace Better.Tools.Runtime -{ - public class BetterEditorDefines - { - public const string BetterPrefix = nameof(Better); - public const string ProjectPrefix = "Project"; - public const string HighlightPrefix = "Highlight Settings"; - public const string ResourcesPrefix = nameof(Resources); - public const string Editor = "UNITY_EDITOR"; - - public const BindingFlags MethodFlags = BindingFlags.Public | BindingFlags.NonPublic | - BindingFlags.Static | BindingFlags.Instance | - BindingFlags.DeclaredOnly; - - public const BindingFlags FieldsFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; - - public const BindingFlags ConstructorFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic; - } -} \ No newline at end of file diff --git a/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs.meta b/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs.meta deleted file mode 100644 index bd5c3fa..0000000 --- a/Assets/BetterEditorTools/Runtime/BetterEditorDefines.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9c8f2eac27a14571a3cdfc714f25a358 -timeCreated: 1685283071 \ No newline at end of file diff --git a/Assets/BetterEditorTools/Runtime/BetterEditorTools.Runtime.asmdef b/Assets/BetterEditorTools/Runtime/BetterEditorTools.Runtime.asmdef index 4b066af..79d198a 100644 --- a/Assets/BetterEditorTools/Runtime/BetterEditorTools.Runtime.asmdef +++ b/Assets/BetterEditorTools/Runtime/BetterEditorTools.Runtime.asmdef @@ -1,7 +1,9 @@ { "name": "BetterEditorTools.Runtime", "rootNamespace": "Better.Tools", - "references": [], + "references": [ + "GUID:01df13aca8d01e24a911bcc3e8277031" + ], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, diff --git a/Assets/BetterEditorTools/package.json b/Assets/BetterEditorTools/package.json index 4ca3f96..703012b 100644 --- a/Assets/BetterEditorTools/package.json +++ b/Assets/BetterEditorTools/package.json @@ -2,11 +2,12 @@ "name": "com.uurha.bettereditortools", "displayName": "Better Editor Tools", "description": "Collection of useful tools for Unity Editor", - "version": "1.0.70", + "version": "1.0.71", "unity": "2020.1", "dependencies": { "com.uurha.betterdatastructures": "0.1.2", - "com.uurha.betterextensions": "1.2.2" + "com.uurha.betterextensions": "1.2.3", + "com.tdw.better.internal.core": "0.0.2" }, "author": { "name": "Better Plugins", diff --git a/Packages/manifest.json b/Packages/manifest.json index bdcfee6..d6dfc4d 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.tdw.better.internal.core": "0.0.2", "com.unity.collab-proxy": "1.17.7", "com.unity.feature.development": "1.0.1", "com.unity.ide.rider": "3.0.16", @@ -11,7 +12,7 @@ "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.7.8", "com.uurha.betterdatastructures": "0.1.2", - "com.uurha.betterextensions": "1.1.98", + "com.uurha.betterextensions": "1.2.3", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 2f75e2a..1021b25 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,12 @@ { "dependencies": { + "com.tdw.better.internal.core": { + "version": "0.0.2", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://package.openupm.com" + }, "com.unity.collab-proxy": { "version": "1.17.7", "depth": 0, @@ -163,7 +170,7 @@ "url": "https://package.openupm.com" }, "com.uurha.betterextensions": { - "version": "1.1.98", + "version": "1.2.3", "depth": 0, "source": "registry", "dependencies": {},