mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
fix: add BeginProperty to AvatarObjectReferenceDrawer
This commit is contained in:
parent
cca9e22edd
commit
ad9d9019c5
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user