public override float GetPropertyHeight( SerializedProperty property, GUIContent label) { var height = EditorGUIUtility.singleLineHeight; if (property.isExpanded) { var serializedObject = property.serializedObject; var asset = serializedObject.targetObject; using (new ObjectScope(asset)) { var target = property.objectReferenceValue; var targetExists = target != null; if (targetExists && !ObjectScope.Contains(target)) { var spacing = EditorGUIUtility.standardVerticalSpacing; height += spacing; height += GetInlinePropertyHeight(target); height += 1; } } } return(height); }
public override void OnGUI( Rect position, SerializedProperty property, GUIContent label) { var propertyRect = position; propertyRect.height = EditorGUIUtility.singleLineHeight; DoContextMenuGUI(propertyRect, property); DoObjectFieldGUI(propertyRect, property, label); DoFoldoutGUI(propertyRect, property); if (property.isExpanded) { var serializedObject = property.serializedObject; var asset = serializedObject.targetObject; using (new ObjectScope(asset)) { var target = property.objectReferenceValue; var targetExists = target != null; if (targetExists && !ObjectScope.Contains(target)) { var inlineRect = position; inlineRect.yMin = propertyRect.yMax; var spacing = EditorGUIUtility.standardVerticalSpacing; inlineRect.yMin += spacing; inlineRect.yMax -= 1; DoInlinePropertyGUI(inlineRect, target); } } } DiscardObsoleteSerializedObjectsOnNextEditorUpdate(); }