1.8.2: Fixed a couple of more issues with certain using EditorGUI.PropertyField, and removed label element from SerializeReferenceTo when used in an array
This commit is contained in:
parent
b189ec8b97
commit
61c7356b3a
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue