From dead48d75e09ccd2960097e14634c42e9ae70bdf Mon Sep 17 00:00:00 2001 From: TextusGames Date: Sat, 16 May 2020 18:18:03 +0300 Subject: [PATCH 1/3] Created new brunch. Plug in Rider's version control --- .gitignore | 3 ++- .../Core/SerializeReferenceTypeNameUtility.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f49c656..147d1e0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,11 @@ [Tt]emp/ [Oo]bj/ [Bb]uild/ -[Bb]uilds/ +[Bb]uilds/ [Ll]ogs/ [Mm]emoryCaptures/ +.[Ii]dea/ [Pp]rojectSettings/ [Pp]ackages/ diff --git a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs index 97555a5..53c2b12 100644 --- a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs +++ b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs @@ -10,6 +10,7 @@ public static class SerializeReferenceTypeNameUtility var realType = Type.GetType($"{names.ClassName}, {names.AssemblyName}"); return realType; } + public static (string AssemblyName, string ClassName) GetSplitNamesFromTypename(string typename) { if (string.IsNullOrEmpty(typename)) From f47dd5d3502ccb8bd9d39fc4db78d36030850601 Mon Sep 17 00:00:00 2001 From: TextusGames Date: Sat, 16 May 2020 18:23:12 +0300 Subject: [PATCH 2/3] Created new brunch. Plug in Rider's version control --- .../Scenes/SerializeRefereneceUIExampleScene.unity | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity b/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity index c7c57ae..bcb5c48 100644 --- a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity +++ b/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity @@ -165,13 +165,13 @@ MonoBehaviour: classWithChildReferences: - integerValue: 0 animals: - id: 0 - animalInterfaces: id: 6 + animalInterfaces: + id: 7 references: version: 1 00000000: - type: {class: BlackApe, ns: , asm: SerializedReferenceExample} + type: {class: GreenApe, ns: , asm: SerializedReferenceExample} data: age: 0 food: {fileID: 0} @@ -208,6 +208,13 @@ MonoBehaviour: numberOfBones: 0 Tag: 00000006: + type: {class: BlackApe, ns: , asm: SerializedReferenceExample} + data: + age: 0 + food: {fileID: 0} + numberOfBones: 0 + Tag: + 00000007: type: {class: GreenFish, ns: , asm: SerializedReferenceExample} data: age: 0 From eeaadfc569e9e6dd51c0f4f39e3cd5bfce027184 Mon Sep 17 00:00:00 2001 From: TextusGames Date: Sat, 16 May 2020 20:15:24 +0300 Subject: [PATCH 3/3] Major refactor. Core now formed and contains all useful utility to create custom ui with restrictions. Many methods was extracted from different classes and moved to core. Undo is now supported(because unity's undo bug seems to be fixed). Example now moved into same level separate folder. --- .../Core/ManagedReferenceUtility.cs | 95 +++++++++++++++++++ ...s.meta => ManagedReferenceUtility.cs.meta} | 0 .../SerializeReferenceGenericSelectionMenu.cs | 63 +++--------- .../Core/SerializeReferenceTypeNameUtility.cs | 24 ----- ...erializeReferenceTypeRestrictionFilters.cs | 2 +- ...izeReferenceTypeRestrictionFilters.cs.meta | 0 ...estriction.meta => DefaultAttributes.meta} | 0 .../SerializeReferenceButtonAttribute.meta} | 0 .../SerializeReferenceButtonAttribute.cs | 0 .../SerializeReferenceButtonAttribute.cs.meta | 0 ...SerializeReferenceButtonAttributeDrawer.cs | 2 +- ...lizeReferenceButtonAttributeDrawer.cs.meta | 0 .../SerializeReferenceMenuAttribute.meta} | 0 .../SerializeReferenceMenuAttribute.cs | 0 .../SerializeReferenceMenuAttribute.cs.meta | 0 .../SerializeReferenceMenuAttributeDrawer.cs | 2 +- ...ializeReferenceMenuAttributeDrawer.cs.meta | 0 ...izeReferenceUIRestrictionExcludeTypes.meta | 8 ++ ...alizeReferenceUIRestrictionExcludeTypes.cs | 0 ...ReferenceUIRestrictionExcludeTypes.cs.meta | 0 ...izeReferenceUIRestrictionIncludeTypes.meta | 8 ++ ...alizeReferenceUIRestrictionIncludeTypes.cs | 0 ...ReferenceUIRestrictionIncludeTypes.cs.meta | 0 ...izedReferenceUIDefaultTypeRestrictions.cs} | 2 +- ...eferenceUIDefaultTypeRestrictions.cs.meta} | 0 .../{Drawing.meta => DefaultUI.meta} | 0 .../SerializeReferenceInspectorButton.cs | 2 +- .../SerializeReferenceInspectorButton.cs.meta | 0 ...ializeReferenceInspectorMiddleMouseMenu.cs | 0 ...eReferenceInspectorMiddleMouseMenu.cs.meta | 0 ....meta => SerializeReferenceUIExample.meta} | 0 .../ExampleAnimalWorldAssembly.meta | 0 .../AmimalWorld.asmdef | 0 .../AmimalWorld.asmdef.meta | 0 .../ExampleAnimalWorldAssembly/Animals.meta | 0 .../Animals/AnimalBase.cs | 0 .../Animals/AnimalBase.cs.meta | 0 .../Animals/IAnimal.cs | 0 .../Animals/IAnimal.cs.meta | 0 .../Animals/MammalBase.cs | 0 .../Animals/MammalBase.cs.meta | 0 .../ExampleFolderCanBeSafelyRemoved.txt | 0 .../ExampleFolderCanBeSafelyRemoved.txt.meta | 0 .../ExampleOfUsageFromDifferentAssembly.meta | 0 .../Animals.meta | 0 .../Animals/ApeBase.cs | 0 .../Animals/ApeBase.cs.meta | 0 .../Animals/CatBase.cs | 0 .../Animals/CatBase.cs.meta | 0 .../Animals/DogBase.cs | 0 .../Animals/DogBase.cs.meta | 0 .../Animals/FishBase.cs | 0 .../Animals/FishBase.cs.meta | 0 .../Animals/InsectBase.cs | 0 .../Animals/InsectBase.cs.meta | 0 .../SerializedReferenceExample.asmdef | 0 .../SerializedReferenceExample.asmdef.meta | 0 .../TestingAnimalWorldExample.meta | 0 .../TestingAnimalWorldExample/Scenes.meta | 0 .../Scenes/SampleSceneSettings.lighting | 0 .../Scenes/SampleSceneSettings.lighting.meta | 0 .../SerializeRefereneceUIExampleScene.unity | 16 ++-- ...rializeRefereneceUIExampleScene.unity.meta | 0 .../TestingAnimalWorldExample/Test.cs | 0 .../TestingAnimalWorldExample/Test.cs.meta | 0 65 files changed, 138 insertions(+), 86 deletions(-) create mode 100644 Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs rename Assets/Textus/SerializeReferenceUI/Core/{SerializeReferenceTypeNameUtility.cs.meta => ManagedReferenceUtility.cs.meta} (100%) delete mode 100644 Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs rename Assets/Textus/SerializeReferenceUI/{Restriction => Core}/SerializeReferenceTypeRestrictionFilters.cs (97%) rename Assets/Textus/SerializeReferenceUI/{Restriction => Core}/SerializeReferenceTypeRestrictionFilters.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Restriction.meta => DefaultAttributes.meta} (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceButton.meta => DefaultAttributes/SerializeReferenceButtonAttribute.meta} (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceButton => DefaultAttributes/SerializeReferenceButtonAttribute}/SerializeReferenceButtonAttribute.cs (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceButton => DefaultAttributes/SerializeReferenceButtonAttribute}/SerializeReferenceButtonAttribute.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceButton => DefaultAttributes/SerializeReferenceButtonAttribute}/SerializeReferenceButtonAttributeDrawer.cs (94%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceButton => DefaultAttributes/SerializeReferenceButtonAttribute}/SerializeReferenceButtonAttributeDrawer.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceMenu.meta => DefaultAttributes/SerializeReferenceMenuAttribute.meta} (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceMenu => DefaultAttributes/SerializeReferenceMenuAttribute}/SerializeReferenceMenuAttribute.cs (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceMenu => DefaultAttributes/SerializeReferenceMenuAttribute}/SerializeReferenceMenuAttribute.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceMenu => DefaultAttributes/SerializeReferenceMenuAttribute}/SerializeReferenceMenuAttributeDrawer.cs (92%) rename Assets/Textus/SerializeReferenceUI/{Drawing/SerializeReferenceMenu => DefaultAttributes/SerializeReferenceMenuAttribute}/SerializeReferenceMenuAttributeDrawer.cs.meta (100%) create mode 100644 Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes.meta rename Assets/Textus/SerializeReferenceUI/{Restriction => DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes}/SerializeReferenceUIRestrictionExcludeTypes.cs (100%) rename Assets/Textus/SerializeReferenceUI/{Restriction => DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes}/SerializeReferenceUIRestrictionExcludeTypes.cs.meta (100%) create mode 100644 Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes.meta rename Assets/Textus/SerializeReferenceUI/{Restriction => DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes}/SerializeReferenceUIRestrictionIncludeTypes.cs (100%) rename Assets/Textus/SerializeReferenceUI/{Restriction => DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes}/SerializeReferenceUIRestrictionIncludeTypes.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs => DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs} (93%) rename Assets/Textus/SerializeReferenceUI/{Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs.meta => DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs.meta} (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing.meta => DefaultUI.meta} (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing => DefaultUI}/SerializeReferenceInspectorButton.cs (94%) rename Assets/Textus/SerializeReferenceUI/{Drawing => DefaultUI}/SerializeReferenceInspectorButton.cs.meta (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing => DefaultUI}/SerializeReferenceInspectorMiddleMouseMenu.cs (100%) rename Assets/Textus/SerializeReferenceUI/{Drawing => DefaultUI}/SerializeReferenceInspectorMiddleMouseMenu.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example.meta => SerializeReferenceUIExample.meta} (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/AmimalWorld.asmdef (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/AmimalWorld.asmdef.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/IAnimal.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/IAnimal.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/MammalBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleAnimalWorldAssembly/Animals/MammalBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleFolderCanBeSafelyRemoved.txt (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleFolderCanBeSafelyRemoved.txt.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity (95%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity.meta (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs (100%) rename Assets/Textus/{SerializeReferenceUI/Example => SerializeReferenceUIExample}/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs.meta (100%) diff --git a/Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs b/Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs new file mode 100644 index 0000000..79746d4 --- /dev/null +++ b/Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs @@ -0,0 +1,95 @@ +#if UNITY_EDITOR + +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEngine; +using Object = UnityEngine.Object; + +public static class ManagedReferenceUtility +{ + /// Creates instance of passed type and assigns it to managed reference + public static object AssignNewInstanceOfTypeToManagedReference(this SerializedProperty serializedProperty, Type type) + { + var instance = Activator.CreateInstance(type); + + serializedProperty.serializedObject.Update(); + serializedProperty.managedReferenceValue = instance; + serializedProperty.serializedObject.ApplyModifiedProperties(); + + return instance; + } + + /// Sets managed reference to null + public static void SetManagedReferenceToNull(this SerializedProperty serializedProperty) + { + serializedProperty.serializedObject.Update(); + serializedProperty.managedReferenceValue = null; + serializedProperty.serializedObject.ApplyModifiedProperties(); + } + + /// Collects appropriate types based on managed reference field type and filters. Filters all derive + public static IEnumerable GetAppropriateTypesForAssigningToManagedReference(this SerializedProperty property, List> filters = null) + { + var fieldType = property.GetManagedReferenceFieldType(); + return GetAppropriateTypesForAssigningToManagedReference(fieldType, filters); + } + + /// Filters derived types of field typ parameter and finds ones whose are compatible with managed reference and filters. + public static IEnumerable GetAppropriateTypesForAssigningToManagedReference(Type fieldType, List> filters = null) + { + var appropriateTypes = new List(); + + // Get and filter all appropriate types + var derivedTypes = TypeCache.GetTypesDerivedFrom(fieldType); + foreach (var type in derivedTypes) + { + // Skips unity engine Objects (because they are not serialized by SerializeReference) + if (type.IsSubclassOf(typeof(Object))) + continue; + // Skip abstract classes because they should not be instantiated + if (type.IsAbstract) + continue; + // Filter types by provided filters if there is ones + if (filters != null && filters.All(f => f == null || f.Invoke(type)) == false) + continue; + + appropriateTypes.Add(type); + } + + return appropriateTypes; + } + + /// Gets real type of managed reference + public static Type GetManagedReferenceFieldType(this SerializedProperty property) + { + var realPropertyType = GetRealTypeFromTypename(property.managedReferenceFieldTypename); + if (realPropertyType != null) + return realPropertyType; + + Debug.LogError($"Can not get field type of managed reference : {property.managedReferenceFieldTypename}"); + return null; + } + + /// Gets real type of managed reference's field typeName + public static Type GetRealTypeFromTypename(string stringType) + { + var names = GetSplitNamesFromTypename(stringType); + var realType = Type.GetType($"{names.ClassName}, {names.AssemblyName}"); + return realType; + } + + /// Get assembly and class names from typeName + public static (string AssemblyName, string ClassName) GetSplitNamesFromTypename(string typename) + { + if (string.IsNullOrEmpty(typename)) + return ("",""); + + var typeSplitString = typename.Split(char.Parse(" ")); + var typeClassName = typeSplitString[1]; + var typeAssemblyName = typeSplitString[0]; + return (typeAssemblyName, typeClassName); + } +} +#endif \ No newline at end of file diff --git a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs.meta b/Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs.meta rename to Assets/Textus/SerializeReferenceUI/Core/ManagedReferenceUtility.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceGenericSelectionMenu.cs b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceGenericSelectionMenu.cs index 2015124..a7490a3 100644 --- a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceGenericSelectionMenu.cs +++ b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceGenericSelectionMenu.cs @@ -9,7 +9,7 @@ using UnityEngine; public static class SerializeReferenceGenericSelectionMenu { /// Purpose. - /// This is generic selection menu. + /// This is generic selection menu. /// Filtering. /// You can add substring filter here to filter by search string. /// As well ass type or interface restrictions. @@ -22,72 +22,39 @@ public static class SerializeReferenceGenericSelectionMenu context.ShowAsContext(); } - private static void FillContextMenu(IEnumerable> enumerableFilters, GenericMenu contextMenu, SerializedProperty property) { var filters = enumerableFilters.ToList();// Prevents possible multiple enumerations // Adds "Make Null" menu command - contextMenu.AddItem(new GUIContent("Null"), false, () => MakeSerializedPropertyNull(property)); - - // Find real type of managed reference - var realPropertyType = SerializeReferenceTypeNameUtility.GetRealTypeFromTypename(property.managedReferenceFieldTypename); - if (realPropertyType == null) - { - Debug.LogError("Can not get type from"); - return; - } + contextMenu.AddItem(new GUIContent("Null"), false, property.SetManagedReferenceToNull); - // Get and filter all appropriate types - var types = TypeCache.GetTypesDerivedFrom(realPropertyType); - foreach (var type in types) - { - // Skips unity engine Objects (because they are not serialized by SerializeReference) - if(type.IsSubclassOf(typeof(UnityEngine.Object))) - continue; - // Skip abstract classes because they should not be instantiated - if(type.IsAbstract) - continue; - // Filter types by provided filters if there is ones - if (FilterTypeByFilters(filters, type) == false) - continue; - - AddItemToContextMenu(type, contextMenu, property); - } - } - - private static void MakeSerializedPropertyNull(SerializedProperty serializedProperty) - { - serializedProperty.serializedObject.Update(); - serializedProperty.managedReferenceValue = null; - serializedProperty.serializedObject.ApplyModifiedPropertiesWithoutUndo(); // undo is bugged for now + // Collects appropriate types + var appropriateTypes = property.GetAppropriateTypesForAssigningToManagedReference(filters); + + // Adds appropriate types to menu + foreach (var appropriateType in appropriateTypes) + AddItemToContextMenu(appropriateType, contextMenu, property); } private static void AddItemToContextMenu(Type type, GenericMenu genericMenuContext, SerializedProperty property) { var assemblyName = type.Assembly.ToString().Split('(', ',')[0]; var entryName = type + " ( " + assemblyName + " )"; - genericMenuContext.AddItem(new GUIContent(entryName), false, AssignNewInstanceOfType, new AssignInstanceGenericMenuParameter(type, property)); + genericMenuContext.AddItem(new GUIContent(entryName), false, AssignNewInstanceCommand, new GenericMenuParameterForAssignInstanceCommand(type, property)); } - private static void AssignNewInstanceOfType(object objectGenericMenuParameter ) + private static void AssignNewInstanceCommand(object objectGenericMenuParameter ) { - var parameter = (AssignInstanceGenericMenuParameter) objectGenericMenuParameter; + var parameter = (GenericMenuParameterForAssignInstanceCommand) objectGenericMenuParameter; var type = parameter.Type; var property = parameter.Property; - var instance = Activator.CreateInstance(type); - property.serializedObject.Update(); - property.managedReferenceValue = instance; - property.serializedObject.ApplyModifiedPropertiesWithoutUndo(); // undo is bugged for now - } - - private static bool FilterTypeByFilters (IEnumerable> filters, Type type) => - filters.All(f => f == null || f.Invoke(type)); + property.AssignNewInstanceOfTypeToManagedReference(type); + } - - private readonly struct AssignInstanceGenericMenuParameter + private readonly struct GenericMenuParameterForAssignInstanceCommand { - public AssignInstanceGenericMenuParameter(Type type, SerializedProperty property) + public GenericMenuParameterForAssignInstanceCommand(Type type, SerializedProperty property) { Type = type; Property = property; diff --git a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs deleted file mode 100644 index 53c2b12..0000000 --- a/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeNameUtility.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -/// This utility exists, because serialize reference managed reference typename returns combined string -/// and not data class that contains separate strings for assembly name and for class name (and possibly namespace name) -public static class SerializeReferenceTypeNameUtility -{ - public static Type GetRealTypeFromTypename(string stringType) - { - var names = GetSplitNamesFromTypename(stringType); - var realType = Type.GetType($"{names.ClassName}, {names.AssemblyName}"); - return realType; - } - - public static (string AssemblyName, string ClassName) GetSplitNamesFromTypename(string typename) - { - if (string.IsNullOrEmpty(typename)) - return ("",""); - - var typeSplitString = typename.Split(char.Parse(" ")); - var typeClassName = typeSplitString[1]; - var typeAssemblyName = typeSplitString[0]; - return (typeAssemblyName, typeClassName); - } -} \ No newline at end of file diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceTypeRestrictionFilters.cs b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeRestrictionFilters.cs similarity index 97% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceTypeRestrictionFilters.cs rename to Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeRestrictionFilters.cs index 95e4a19..bfe06a6 100644 --- a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceTypeRestrictionFilters.cs +++ b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeRestrictionFilters.cs @@ -1,4 +1,4 @@ -using System; + using System; using System.Linq; public static class SerializeReferenceTypeRestrictionFilters diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceTypeRestrictionFilters.cs.meta b/Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeRestrictionFilters.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceTypeRestrictionFilters.cs.meta rename to Assets/Textus/SerializeReferenceUI/Core/SerializeReferenceTypeRestrictionFilters.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Restriction.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttribute.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttribute.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttribute.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttribute.cs diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttribute.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttribute.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttribute.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttribute.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttributeDrawer.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttributeDrawer.cs similarity index 94% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttributeDrawer.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttributeDrawer.cs index 08901e5..e266bde 100644 --- a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttributeDrawer.cs +++ b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttributeDrawer.cs @@ -20,7 +20,7 @@ public class SerializeReferenceButtonAttributeDrawer : PropertyDrawer var labelPosition = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); EditorGUI.LabelField(labelPosition, label); - var typeRestrictions = SerializedReferenceUIBuiltInTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo); + var typeRestrictions = SerializedReferenceUIDefaultTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo); property.DrawSelectionButtonForManagedReference(position, typeRestrictions); EditorGUI.PropertyField(position, property, GUIContent.none, true); diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttributeDrawer.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttributeDrawer.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceButton/SerializeReferenceButtonAttributeDrawer.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceButtonAttribute/SerializeReferenceButtonAttributeDrawer.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttribute.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttribute.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttribute.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttribute.cs diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttribute.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttribute.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttribute.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttribute.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttributeDrawer.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttributeDrawer.cs similarity index 92% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttributeDrawer.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttributeDrawer.cs index a228abb..4c1f71a 100644 --- a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttributeDrawer.cs +++ b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttributeDrawer.cs @@ -15,7 +15,7 @@ public class SerializeReferenceMenuAttributeDrawer : PropertyDrawer { EditorGUI.BeginProperty(position, label, property); - var typeRestrictions = SerializedReferenceUIBuiltInTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo); + var typeRestrictions = SerializedReferenceUIDefaultTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo); property.ShowContextMenuForManagedReferenceOnMouseMiddleButton(position, typeRestrictions); EditorGUI.PropertyField(position, property, true); diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttributeDrawer.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttributeDrawer.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceMenu/SerializeReferenceMenuAttributeDrawer.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceMenuAttribute/SerializeReferenceMenuAttributeDrawer.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes.meta new file mode 100644 index 0000000..d774d13 --- /dev/null +++ b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3fbe55d72b5fd59459fdb52e0f301ea1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionExcludeTypes.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes/SerializeReferenceUIRestrictionExcludeTypes.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionExcludeTypes.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes/SerializeReferenceUIRestrictionExcludeTypes.cs diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionExcludeTypes.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes/SerializeReferenceUIRestrictionExcludeTypes.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionExcludeTypes.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionExcludeTypes/SerializeReferenceUIRestrictionExcludeTypes.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes.meta new file mode 100644 index 0000000..2ab11e3 --- /dev/null +++ b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c0c77910f7962a14cb85132596cb8d24 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionIncludeTypes.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes/SerializeReferenceUIRestrictionIncludeTypes.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionIncludeTypes.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes/SerializeReferenceUIRestrictionIncludeTypes.cs diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionIncludeTypes.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes/SerializeReferenceUIRestrictionIncludeTypes.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializeReferenceUIRestrictionIncludeTypes.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializeReferenceUIRestrictionIncludeTypes/SerializeReferenceUIRestrictionIncludeTypes.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs similarity index 93% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs index 2b5bd96..80dd966 100644 --- a/Assets/Textus/SerializeReferenceUI/Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs +++ b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Reflection; -public static class SerializedReferenceUIBuiltInTypeRestrictions +public static class SerializedReferenceUIDefaultTypeRestrictions { public static IEnumerable> GetAllBuiltInTypeRestrictions(FieldInfo fieldInfo) { diff --git a/Assets/Textus/SerializeReferenceUI/Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Restriction/SerializedReferenceUIBuiltInTypeRestrictions.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultAttributes/SerializedReferenceUIDefaultTypeRestrictions.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing.meta b/Assets/Textus/SerializeReferenceUI/DefaultUI.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing.meta rename to Assets/Textus/SerializeReferenceUI/DefaultUI.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorButton.cs b/Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorButton.cs similarity index 94% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorButton.cs rename to Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorButton.cs index bd06f09..59b8879 100644 --- a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorButton.cs +++ b/Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorButton.cs @@ -31,7 +31,7 @@ public static class SerializeReferenceInspectorButton GUI.backgroundColor = backgroundColor; - var names = SerializeReferenceTypeNameUtility.GetSplitNamesFromTypename(property.managedReferenceFullTypename); + var names = ManagedReferenceUtility.GetSplitNamesFromTypename(property.managedReferenceFullTypename); var className = string.IsNullOrEmpty(names.ClassName) ? "Null (Assign)" : names.ClassName; var assemblyName = names.AssemblyName; if (GUI.Button(buttonPosition, new GUIContent(className, className + " ( "+ assemblyName +" )" ))) diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorButton.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorButton.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorButton.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorButton.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorMiddleMouseMenu.cs b/Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorMiddleMouseMenu.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorMiddleMouseMenu.cs rename to Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorMiddleMouseMenu.cs diff --git a/Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorMiddleMouseMenu.cs.meta b/Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorMiddleMouseMenu.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Drawing/SerializeReferenceInspectorMiddleMouseMenu.cs.meta rename to Assets/Textus/SerializeReferenceUI/DefaultUI/SerializeReferenceInspectorMiddleMouseMenu.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example.meta b/Assets/Textus/SerializeReferenceUIExample.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example.meta rename to Assets/Textus/SerializeReferenceUIExample.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/AmimalWorld.asmdef b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/AmimalWorld.asmdef similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/AmimalWorld.asmdef rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/AmimalWorld.asmdef diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/AmimalWorld.asmdef.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/AmimalWorld.asmdef.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/AmimalWorld.asmdef.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/AmimalWorld.asmdef.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/AnimalBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/IAnimal.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/IAnimal.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/IAnimal.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/IAnimal.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/IAnimal.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/IAnimal.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/IAnimal.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/IAnimal.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/MammalBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/MammalBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/MammalBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/MammalBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/MammalBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/MammalBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleAnimalWorldAssembly/Animals/MammalBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleAnimalWorldAssembly/Animals/MammalBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleFolderCanBeSafelyRemoved.txt b/Assets/Textus/SerializeReferenceUIExample/ExampleFolderCanBeSafelyRemoved.txt similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleFolderCanBeSafelyRemoved.txt rename to Assets/Textus/SerializeReferenceUIExample/ExampleFolderCanBeSafelyRemoved.txt diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleFolderCanBeSafelyRemoved.txt.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleFolderCanBeSafelyRemoved.txt.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleFolderCanBeSafelyRemoved.txt.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleFolderCanBeSafelyRemoved.txt.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/ApeBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/CatBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/DogBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/FishBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/Animals/InsectBase.cs.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/SerializedReferenceExample.asmdef.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SampleSceneSettings.lighting.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity similarity index 95% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity index bcb5c48..87a658f 100644 --- a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity +++ b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity @@ -171,19 +171,17 @@ MonoBehaviour: references: version: 1 00000000: - type: {class: GreenApe, ns: , asm: SerializedReferenceExample} + type: {class: GoldenApe, ns: , asm: SerializedReferenceExample} data: - age: 0 - food: {fileID: 0} - numberOfBones: 0 - Tag: + age: 1231 + food: {fileID: 1131539293} + numberOfBones: 33 + Tag: dd 00000001: - type: {class: RedCat, ns: , asm: SerializedReferenceExample} + type: {class: AnimalChild, ns: , asm: AmimalWorld} data: - age: 0 + age: 3213 food: {fileID: 0} - numberOfBones: 0 - Tag: 00000002: type: {class: , ns: , asm: } 00000003: diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Scenes/SerializeRefereneceUIExampleScene.unity.meta diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs diff --git a/Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs.meta b/Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs.meta similarity index 100% rename from Assets/Textus/SerializeReferenceUI/Example/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs.meta rename to Assets/Textus/SerializeReferenceUIExample/ExampleOfUsageFromDifferentAssembly/TestingAnimalWorldExample/Test.cs.meta