Example #1
0
        public override void OnGUI(Rect startPosition, SerializedProperty property, GUIContent label)
        {
            SetupProperty(property);
            Rect position = new Rect(startPosition);

            bool didDrawMainControl = false;

            foreach (var drawer in DecorationAttributeDrawer.GetDecorationAttributeDrawers(fieldInfo, parentObjects))
            {
                if (!didDrawMainControl && drawer.attribute.order > attribute.order)
                {
                    position           = OnMainGUI(position, property, label);
                    didDrawMainControl = true;
                }

                position.height = drawer.GetControlHeight();
                drawer.DrawControl(position);
                position.y += position.height + EditorGUIUtility.standardVerticalSpacing;
            }

            if (!didDrawMainControl)
            {
                OnMainGUI(position, property, label);
            }
        }
Example #2
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            InspectorAttribute attr = (InspectorAttribute)attribute;

            SetupProperty(property);

            float height = 0;

            if (attr.visibleCheck == null || GetMemberBoolean(attr.visibleCheck))
            {
                height = GetControlHeight(property, CustomizeLabel(label));
            }
            else
            {
                height -= EditorGUIUtility.standardVerticalSpacing;
            }

            foreach (var drawer in DecorationAttributeDrawer.GetDecorationAttributeDrawers(fieldInfo, parentObjects))
            {
                height += drawer.GetControlHeight() + EditorGUIUtility.standardVerticalSpacing;
            }

            return(height);
        }