1.11.2: Fixed issue, where ReadableScriptableObject would block input to later drawn fields, due to Repaint having reverse drawing order (fixed for 6.3.0 or newer)
This commit is contained in:
parent
f4c4a58283
commit
6e3bd4df70
|
|
@ -16,12 +16,11 @@ namespace Module.Inspector.Editor
|
|||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
{
|
||||
if (property.objectReferenceValue != null)
|
||||
{
|
||||
property.isExpanded = DrawFoldout(position, property, label);
|
||||
|
||||
|
||||
if (property.isExpanded)
|
||||
DrawContent(position, property.objectReferenceValue, att.editable);
|
||||
}
|
||||
|
|
@ -44,7 +43,6 @@ namespace Module.Inspector.Editor
|
|||
property.objectReferenceValue = EditorGUI.ObjectField(rectObj, property.objectReferenceValue, property.GetValueType(), false);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
bool hasChanged = EditorGUI.EndChangeCheck();
|
||||
|
||||
|
|
@ -78,6 +76,11 @@ namespace Module.Inspector.Editor
|
|||
GUIStyle style = property.objectReferenceValue != null ? EditorStyles.foldoutHeader : EditorStyles.label;
|
||||
bool foldout = property.isExpanded;
|
||||
|
||||
#if UNITY_6000_3_OR_NEWER
|
||||
position.width = rectObj.x - position.x;
|
||||
foldout = GUI.Toggle(position, foldout, label, style);
|
||||
property.objectReferenceValue = EditorGUI.ObjectField(rectObj, property.objectReferenceValue, property.GetValueType(), false);
|
||||
#else
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
GUI.Toggle(position, foldout, label, style);
|
||||
|
|
@ -88,6 +91,7 @@ namespace Module.Inspector.Editor
|
|||
property.objectReferenceValue = EditorGUI.ObjectField(rectObj, property.objectReferenceValue, property.GetValueType(), false);
|
||||
foldout = GUI.Toggle(position, foldout, label, style);
|
||||
}
|
||||
#endif
|
||||
|
||||
return foldout;
|
||||
}
|
||||
|
|
@ -96,28 +100,28 @@ namespace Module.Inspector.Editor
|
|||
{
|
||||
var serializedObject = new SerializedObject(obj);
|
||||
SerializedProperty it = serializedObject.GetIterator();
|
||||
|
||||
|
||||
it.NextVisible(true);
|
||||
rect.y += EditorGUIUtility.singleLineHeight;
|
||||
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
bool prevEnabled = GUI.enabled;
|
||||
GUI.enabled = prevEnabled && editable;
|
||||
|
||||
|
||||
while (it.NextVisible(false))
|
||||
{
|
||||
rect.height = EditorGUI.GetPropertyHeight(it);
|
||||
EditorGUI.PropertyField(rect, it, new GUIContent(it.displayName), true);
|
||||
rect.y += rect.height;
|
||||
}
|
||||
|
||||
|
||||
GUI.enabled = prevEnabled;
|
||||
}
|
||||
bool hasChanged = EditorGUI.EndChangeCheck();
|
||||
EditorGUI.indentLevel--;
|
||||
|
||||
|
||||
if (hasChanged)
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.module.inspector",
|
||||
"version": "1.11.1",
|
||||
"version": "1.11.2",
|
||||
"displayName": "Module.Inspector",
|
||||
"description": "Custom inspector with various useful property drawers",
|
||||
"unity": "2019.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue