Beispiel #1
0
    public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
    {
        var height = EditorGUI.GetPropertyHeight(property, label, true);

        if (property.hasVisibleChildren && property.isExpanded)
        {
            var targetObject = SerializedPropertyUtil.GetTargetObject(property);
            if (targetObject != null)
            {
                height += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
            }
        }
        return(height);
    }
Beispiel #2
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        var typeSelector = attribute as ReferenceTypeSelectorAttribute;
        var targetObject = SerializedPropertyUtil.GetTargetObject(property);

        typeSelector.GetSubTypes(property);

        if (targetObject != null && property.hasVisibleChildren)
        {
            ShowFoldout(position, property, label, typeSelector, targetObject);
        }
        else
        {
            ShowInline(position, property, label, typeSelector, targetObject);
        }
    }