1.8.1: Fixed issue with certain drawers using EditorGUI.PropertyField, which would invoke a second draw with the same attribute
This commit is contained in:
parent
eb19150d98
commit
b189ec8b97
|
|
@ -20,8 +20,10 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
||||||
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
||||||
|
string temp = EditorGUI.TextField(rect0, label, property.stringValue);
|
||||||
|
|
||||||
EditorGUI.PropertyField(rect0, property, label);
|
if (!temp.Equals(property.stringValue))
|
||||||
|
property.stringValue = temp;
|
||||||
|
|
||||||
if (GUI.Button(rect1, "Find"))
|
if (GUI.Button(rect1, "Find"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
||||||
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
||||||
|
string temp = EditorGUI.TextField(rect0, label, property.stringValue);
|
||||||
|
|
||||||
EditorGUI.PropertyField(rect0, property, label);
|
if (!temp.Equals(property.stringValue))
|
||||||
|
property.stringValue = temp;
|
||||||
|
|
||||||
if (GUI.Button(rect1, "Find"))
|
if (GUI.Button(rect1, "Find"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
||||||
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
||||||
|
string temp = EditorGUI.TextField(rect0, label, property.stringValue);
|
||||||
|
|
||||||
EditorGUI.PropertyField(rect0, property, label);
|
if (!temp.Equals(property.stringValue))
|
||||||
|
property.stringValue = temp;
|
||||||
|
|
||||||
if (GUI.Button(rect1, "Find"))
|
if (GUI.Button(rect1, "Find"))
|
||||||
EditorWindowStringToField.Open(att.type, property);
|
EditorWindowStringToField.Open(att.type, property);
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,13 @@ namespace Module.Inspector.Editor
|
||||||
|
|
||||||
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
var rect0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
||||||
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
var rect1 = new Rect(rect0.xMax, position.y, WIDTH, position.height);
|
||||||
|
string temp = EditorGUI.TextField(rect0, label, property.stringValue);
|
||||||
|
|
||||||
EditorGUI.PropertyField(rect0, property, label);
|
if (!temp.Equals(property.stringValue))
|
||||||
|
property.stringValue = temp;
|
||||||
|
|
||||||
if (GUI.Button(rect1, "Find"))
|
if (GUI.Button(rect1, "Find"))
|
||||||
EditorWindowStringToType.Open(att.assignableFrom, property);
|
EditorWindowStringToType.Open(att.assignableFrom, property);
|
||||||
|
|
||||||
}
|
}
|
||||||
EditorGUI.EndProperty();
|
EditorGUI.EndProperty();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -526,7 +526,7 @@ namespace Module.Inspector.Editor
|
||||||
case SerializedPropertyType.BoundsInt:
|
case SerializedPropertyType.BoundsInt:
|
||||||
return property.boundsIntValue.ToString();
|
return property.boundsIntValue.ToString();
|
||||||
case SerializedPropertyType.ManagedReference:
|
case SerializedPropertyType.ManagedReference:
|
||||||
return property.objectReferenceValue != null ? property.objectReferenceValue.ToString() : "null";
|
return property.managedReferenceValue != null ? property.managedReferenceValue.ToString() : "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unable to draw value as string";
|
return "Unable to draw value as string";
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,6 @@ List of all decorator attributes:
|
||||||
To allow fields hidden from inspector either by `NonSerialized` or `HideInInspector` add the following to the class:
|
To allow fields hidden from inspector either by `NonSerialized` or `HideInInspector` add the following to the class:
|
||||||
|
|
||||||
* `EnableShowHiddenFields`
|
* `EnableShowHiddenFields`
|
||||||
* Enables an additional search to find any "hidden" fields and draw them below `DefaultInspector`
|
* Enables an additional search to find any "hidden" fields and draw them below `DefaultInspector`
|
||||||
* `ShowHiddenField`
|
* `ShowHiddenField`
|
||||||
* Optional attribute for fields, if `EnableShowHiddenFields` has parameter `true`
|
* Optional attribute for fields, if `EnableShowHiddenFields` has parameter `true`
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "com.module.inspector",
|
"name": "com.module.inspector",
|
||||||
"version": "1.8.0",
|
"version": "1.8.1",
|
||||||
"displayName": "Module.Inspector",
|
"displayName": "Module.Inspector",
|
||||||
"description": "Custom inspector with various useful property drawers",
|
"description": "Custom inspector with various useful property drawers",
|
||||||
"unity": "2019.2",
|
"unity": "2019.2",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue