public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        CustomDisplayAttribute customDisplay = attribute as CustomDisplayAttribute;

        property.isExpanded = true;

        SerializedProperty endProperty = property.GetEndProperty();

        switch (customDisplay.displayMode)
        {
        case CustomDisplayMode.NoLabel:
            break;

        case CustomDisplayMode.LabelAsHeader:
            position = PropertyDrawerUtil.DrawLabel(label, position, EditorStyles.boldLabel);
            break;

        case CustomDisplayMode.NoDropdown:
            position = PropertyDrawerUtil.DrawLabel(label, position);
            break;
        }

        property.NextVisible(true);

        do
        {
            position = PropertyDrawerUtil.DrawProperty(property, position, true);

            property.NextVisible(false);
        } while (!SerializedProperty.EqualContents(property, endProperty));
    }
Example #2
0
    void InjectArrayDrawer()
    {
        injectArrayDrawer = true;

        var propertyHandler = PropertyDrawerUtil.GetPropertyHandler(this);
        var propertyDrawer  = PropertyDrawerUtil.GetPropertyDrawer(propertyHandler);

        if (propertyDrawer == null)
        {
            propertyDrawer = new ArrayDrawerAdapter(this);
            PropertyDrawerUtil.SetPropertyDrawer(propertyHandler, propertyDrawer);
        }
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        ConditionalHideIntCustomDisplayAttribute condHAtt = (ConditionalHideIntCustomDisplayAttribute)attribute;
        bool enabled = GetConditionalHideAttributeResult(condHAtt, property);

        bool wasEnabled = GUI.enabled;

        GUI.enabled = enabled;
        //if (!condHAtt.HideInInspector || enabled)
        if (condHAtt.Behavior != ConditionalHideBehavior.Hide || enabled)
        {
            property.isExpanded = true;

            SerializedProperty endProperty = property.GetEndProperty();

            switch (condHAtt.DisplayMode)
            {
            case CustomDisplayMode.NoLabel:
                break;

            case CustomDisplayMode.LabelAsHeader:
                position = PropertyDrawerUtil.DrawLabel(label, position, EditorStyles.boldLabel);
                break;

            case CustomDisplayMode.NoDropdown:
                position = PropertyDrawerUtil.DrawLabel(label, position);
                break;
            }

            property.NextVisible(true);

            do
            {
                position = PropertyDrawerUtil.DrawProperty(property, position, true);

                property.NextVisible(false);
            } while (!SerializedProperty.EqualContents(property, endProperty));
        }

        GUI.enabled = wasEnabled;
    }