diff --git a/Editor/Builders/ClassesItemBuilder.cs b/Editor/Builders/ClassesItemBuilder.cs index 6cffcd2..92bdbf3 100644 --- a/Editor/Builders/ClassesItemBuilder.cs +++ b/Editor/Builders/ClassesItemBuilder.cs @@ -56,7 +56,7 @@ private AdvancedDropdownItem GetOrCreateParentItem(Type type, AdvancedDropdownIt foreach (string split in splits) { currentPath += split + '.'; - + if (splitToItem.TryGetValue(currentPath, out AdvancedDropdownItem foundItem)) { splitItem = foundItem; diff --git a/Editor/Builders/SceneItemBuilder.cs b/Editor/Builders/SceneItemBuilder.cs index 0a92d9f..ac2a4ce 100644 --- a/Editor/Builders/SceneItemBuilder.cs +++ b/Editor/Builders/SceneItemBuilder.cs @@ -35,7 +35,7 @@ public AdvancedDropdownItem Build() AdvancedDropdownItem root = new AdvancedDropdownItemWrapper("Scene"); GameObject[] rootGameObjects = scene.Value.GetRootGameObjects(); - + foreach (GameObject rootGameObject in rootGameObjects) { CreateItemsRecursive(rootGameObject.transform, root); @@ -52,12 +52,12 @@ private void CreateItemsRecursive(Transform transform, AdvancedDropdownItem pare }; Component[] components = transform.GetComponents(interfaceType); - + foreach (Component component in components) { advancedDropdownItem.AddChild(new SceneDropdownItem(component)); } - + foreach (Transform child in transform) { CreateItemsRecursive(child, advancedDropdownItem); diff --git a/Editor/Drawers/CustomObjectDrawer.cs b/Editor/Drawers/CustomObjectDrawer.cs index 09697bb..95ac69d 100644 --- a/Editor/Drawers/CustomObjectDrawer.cs +++ b/Editor/Drawers/CustomObjectDrawer.cs @@ -21,7 +21,7 @@ public partial class CustomObjectDrawer public event ClickedDelegate Clicked; public event DeletePressedDelegate DeletePressed; public event PropertiesClickedDelegate PropertiesClicked; - + public void OnGUI(Rect position, GUIContent label, GUIContent content, SerializedProperty property) { Rect positionWithoutThumb = new Rect(position); diff --git a/Editor/Drawers/RawReferenceDrawer.Styles.cs b/Editor/Drawers/RawReferenceDrawer.Styles.cs deleted file mode 100644 index 54f1d0b..0000000 --- a/Editor/Drawers/RawReferenceDrawer.Styles.cs +++ /dev/null @@ -1,21 +0,0 @@ -using UnityEditor; -using UnityEngine; - -namespace TNRD.Drawers -{ - internal partial class RawReferenceDrawer - { - private static class Styles - { - public static Color LineColor - { - get - { - return EditorGUIUtility.isProSkin - ? new Color(0.14f, 0.14f, 0.14f, 0.5f) - : new Color(0.67f, 0.67f, 0.67f); - } - } - } - } -} diff --git a/Editor/Drawers/RawReferenceDrawer.Styles.cs.meta b/Editor/Drawers/RawReferenceDrawer.Styles.cs.meta deleted file mode 100644 index 45b03d1..0000000 --- a/Editor/Drawers/RawReferenceDrawer.Styles.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8d20510403094721b42442d9dc36e443 -timeCreated: 1658531405 \ No newline at end of file diff --git a/Editor/Drawers/RawReferenceDrawer.cs b/Editor/Drawers/RawReferenceDrawer.cs index 9008cb1..b4a6960 100644 --- a/Editor/Drawers/RawReferenceDrawer.cs +++ b/Editor/Drawers/RawReferenceDrawer.cs @@ -51,34 +51,19 @@ public void OnGUI(Rect position) if (rawReferenceValue == null) return; - - DrawLine(position); + DrawProperty(position); - previousPropertyPath = Property.propertyPath; } private void DrawProperty(Rect position) { - Rect objectDrawerRect = new Rect(position); - - EditorGUI.PropertyField(objectDrawerRect, + EditorGUI.PropertyField(position, RawReferenceProperty, GUIContent.none, true); } - private void DrawLine(Rect position) - { - Rect line = new Rect(position) - { - width = 5, - yMin = position.yMin + EditorGUIUtility.singleLineHeight, - x = position.x + EditorGUI.indentLevel * 15 - 9 - }; - EditorGUI.DrawRect(line, Styles.LineColor); - } - protected override void PingObject(SerializedProperty property) { // No support for pinging raw objects for now (I guess this would ping the MonoScript?) @@ -89,7 +74,7 @@ protected override void OnPropertiesClicked(SerializedProperty property) { if (RawReferenceValue == null) return; - + Type type = RawReferenceValue.GetType(); string typeName = type.Name; @@ -108,12 +93,12 @@ protected override void OnPropertiesClicked(SerializedProperty property) private void AvoidDuplicateReferencesInArray() { - if (!ShouldCheckProperty()) + if (!ShouldCheckProperty()) return; object currentReferenceValue = RawReferenceValue; - if (currentReferenceValue == null) + if (currentReferenceValue == null) return; if (previousReferenceValue == currentReferenceValue) @@ -127,8 +112,8 @@ private void AvoidDuplicateReferencesInArray() private bool ShouldCheckProperty() { - return IsPropertyInArray(Property) && - previousPropertyPath != null && + return IsPropertyInArray(Property) && + previousPropertyPath != null && previousPropertyPath != Property.propertyPath; } diff --git a/Editor/Items/NoneDropdownItem.cs b/Editor/Items/NoneDropdownItem.cs index 63e4431..c237e93 100644 --- a/Editor/Items/NoneDropdownItem.cs +++ b/Editor/Items/NoneDropdownItem.cs @@ -2,9 +2,12 @@ namespace TNRD.Items { - public class NoneDropdownItem : AdvancedDropdownItem, IDropdownItem + public class NoneDropdownItem : AdvancedDropdownItem, IDropdownItem { - public NoneDropdownItem() : base("None") { } + public NoneDropdownItem() + : base("None") + { + } ReferenceMode IDropdownItem.Mode => ReferenceMode.Raw; diff --git a/Runtime/AssemblyInfo.cs b/Runtime/AssemblyInfo.cs index 54e5d7c..c174476 100644 --- a/Runtime/AssemblyInfo.cs +++ b/Runtime/AssemblyInfo.cs @@ -1,3 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleTo("TNRD.SerializableInterface.Editor")] +[assembly: InternalsVisibleTo("TNRD.SerializableInterface.Editor")] diff --git a/Runtime/Extensions.cs b/Runtime/Extensions.cs index f87fae2..d89b03f 100644 --- a/Runtime/Extensions.cs +++ b/Runtime/Extensions.cs @@ -31,7 +31,7 @@ out TInterface value value = serializableInterface.Value; return true; } - + /// public static bool TryGetValue( this SerializableInterface serializableInterface,