diff --git a/Editor/Inspector/AvatarObjectReferenceDrawer.cs b/Editor/Inspector/AvatarObjectReferenceDrawer.cs index 3543681e..fd63a708 100644 --- a/Editor/Inspector/AvatarObjectReferenceDrawer.cs +++ b/Editor/Inspector/AvatarObjectReferenceDrawer.cs @@ -8,20 +8,28 @@ namespace nadena.dev.modular_avatar.core.editor { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { - if (CustomGUI(position, property, label)) return; - - var xButtonSize = EditorStyles.miniButtonRight.CalcSize(new GUIContent("x")); - var xButtonRect = new Rect(position.xMax - xButtonSize.x, position.y, xButtonSize.x, position.height); - position = new Rect(position.x, position.y, position.width - xButtonSize.x, position.height); - - property = property.FindPropertyRelative(nameof(AvatarObjectReference.referencePath)); - - position = EditorGUI.PrefixLabel(position, label); - - using (var scope = new ZeroIndentScope()) - { - EditorGUI.LabelField(position, - string.IsNullOrEmpty(property.stringValue) ? "(null)" : property.stringValue); + label = EditorGUI.BeginProperty(position, label, property); + try + { + if (CustomGUI(position, property, label)) return; + + var xButtonSize = EditorStyles.miniButtonRight.CalcSize(new GUIContent("x")); + var xButtonRect = new Rect(position.xMax - xButtonSize.x, position.y, xButtonSize.x, position.height); + position = new Rect(position.x, position.y, position.width - xButtonSize.x, position.height); + + property = property.FindPropertyRelative(nameof(AvatarObjectReference.referencePath)); + + position = EditorGUI.PrefixLabel(position, label); + + using (var scope = new ZeroIndentScope()) + { + EditorGUI.LabelField(position, + string.IsNullOrEmpty(property.stringValue) ? "(null)" : property.stringValue); + } + } + finally + { + EditorGUI.EndProperty(); } }