diff --git a/Editor/Drawers/NamingAttributeDrawer.cs b/Editor/Drawers/NamingAttributeDrawer.cs index 660be3e..917a968 100644 --- a/Editor/Drawers/NamingAttributeDrawer.cs +++ b/Editor/Drawers/NamingAttributeDrawer.cs @@ -20,9 +20,11 @@ namespace Module.Inspector.Editor var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height); var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height); - - EditorGUI.PropertyField(rect0, property, label); - + string temp = EditorGUI.TextField(rect0, label, property.stringValue); + + if (!temp.Equals(property.stringValue)) + property.stringValue = temp; + if (GUI.Button(rect1, "Go")) { string str = EditorNamingUtility.ConvertTo(att.type, property.stringValue); diff --git a/Editor/Drawers/ReadableScriptableObjectAttributeDrawer.cs b/Editor/Drawers/ReadableScriptableObjectAttributeDrawer.cs index 812da6a..5fe9e40 100644 --- a/Editor/Drawers/ReadableScriptableObjectAttributeDrawer.cs +++ b/Editor/Drawers/ReadableScriptableObjectAttributeDrawer.cs @@ -28,7 +28,7 @@ namespace Module.Inspector.Editor else { // Note: Why not use EditorGUI.PropertyField? - // The reason is that the foldout uses Toggle and ObjectField and if if we don't use + // The reason is that the foldout uses Toggle and ObjectField and if we don't use // Label and ObjectField here, then ObjectField will be given a new control id when changing // objectReferenceValue from an existing object to null and back again. The new object will // not be set, due to null giving a new control id. @@ -102,7 +102,6 @@ namespace Module.Inspector.Editor EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); - { bool prevEnabled = GUI.enabled; GUI.enabled = prevEnabled && editable; @@ -116,7 +115,6 @@ namespace Module.Inspector.Editor GUI.enabled = prevEnabled; } - bool hasChanged = EditorGUI.EndChangeCheck(); EditorGUI.indentLevel--; diff --git a/Editor/Drawers/SerializeReferenceToAttributeDrawer.cs b/Editor/Drawers/SerializeReferenceToAttributeDrawer.cs index eb9ad1f..90f9b4a 100644 --- a/Editor/Drawers/SerializeReferenceToAttributeDrawer.cs +++ b/Editor/Drawers/SerializeReferenceToAttributeDrawer.cs @@ -40,8 +40,11 @@ namespace Module.Inspector.Editor height = EditorGUIUtility.singleLineHeight }; + SerializedProperty parent = property.GetParent(); + GUIContent labelContent = parent != null && parent.isArray ? GUIContent.none : label; + int index = Array.IndexOf(arrStrings, ConvertUnityTypeFullnameToCSharpName(property.managedReferenceFullTypename)); - int newIndex = EditorGUI.Popup(rect, label, index, arrGui); + int newIndex = EditorGUI.Popup(rect, labelContent, index, arrGui); if (newIndex != -1 && index != newIndex) { @@ -53,7 +56,7 @@ namespace Module.Inspector.Editor EditorUtility.DisplayDialog("Error", "Failed to set managed reference to selected type.\n\nType must be:\nSerializable\nNot abstract\nNon-generic\nNot a specialization of UnityEngine.Object", "Ok"); } - EditorGUI.PropertyField(position, property, true); + EditorGUI.PropertyField(position, property, GUIContent.none, true); } EditorGUI.EndProperty(); bool hasChanged = EditorGUI.EndChangeCheck(); diff --git a/Editor/Drawers/UrlGoToAttributeDrawer.cs b/Editor/Drawers/UrlGoToAttributeDrawer.cs index da17ac1..cb02d5e 100644 --- a/Editor/Drawers/UrlGoToAttributeDrawer.cs +++ b/Editor/Drawers/UrlGoToAttributeDrawer.cs @@ -18,8 +18,10 @@ namespace Module.Inspector.Editor var r0 = new Rect(position.x, position.y, position.width - WIDTH, position.height); var r1 = new Rect(r0.xMax, r0.y, WIDTH, r0.height); + string temp = EditorGUI.TextField(r0, label, property.stringValue); - EditorGUI.PropertyField(r0, property, label); + if (!temp.Equals(property.stringValue)) + property.stringValue = temp; if (GUI.Button(r1, "Go")) Application.OpenURL(property.stringValue); diff --git a/package.json b/package.json index 415854b..4840a00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.module.inspector", - "version": "1.8.1", + "version": "1.8.2", "displayName": "Module.Inspector", "description": "Custom inspector with various useful property drawers", "unity": "2019.2",