Fix hasChildren display in AtomReferences

The display of an AtomReference would act a bit weird if the Atom was of e.g. a serializable class.
This commit is contained in:
CaseyDeCoder 2021-07-09 14:08:42 +02:00 committed by Miika Lönnqvist
parent 7c372e6c38
commit aecaa73ad0

View File

@ -67,16 +67,12 @@ namespace UnityAtoms.Editor
var newUsageValue = EditorGUI.Popup(buttonRect, currentUsage.intValue, GetPopupOptions(property), _popupStyle);
currentUsage.intValue = newUsageValue;
var usageTypePropertyName = GetUsages(property)[newUsageValue].PropertyName;
var usageTypeProperty = property.FindPropertyRelative(usageTypePropertyName);
var valueFieldHeight = EditorGUI.GetPropertyHeight(property.FindPropertyRelative(usageTypePropertyName), label);
if (usageTypePropertyName == "_value" && valueFieldHeight > EditorGUIUtility.singleLineHeight+2)
if (usageTypePropertyName == "_value")
{
EditorGUI.PropertyField(originalPosition, usageTypeProperty, GUIContent.none, true);
EditorGUI.PropertyField(usageTypeProperty.hasChildren ? originalPosition : position, usageTypeProperty, GUIContent.none, true);
}
else
{