示例#1
0
        public void DrawLayerField(Rect position, SerializedProperty property, LayerFieldAttribute attribute, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"\"{property.displayName}\" should be of type int");
                return;
            }

            int layer;

            if (attribute.Options.Contains(FieldOption.HideLabel))
            {
                layer = EditorGUI.LayerField(position, property.intValue);
            }
            else if (attribute.Options.Contains(FieldOption.BoldLabel))
            {
                layer = EditorGUI.LayerField(position, label ?? EditorGUIUtility.TrTextContent(property.displayName), property.intValue,
                                             EditorStyles.boldLabel);
            }
            else
            {
                layer = EditorGUI.LayerField(position, label ?? EditorGUIUtility.TrTextContent(property.displayName), property.intValue);
            }

            property.intValue = layer;
        }
示例#2
0
        protected override void DrawProperty(MightySerializedField mightyMember, SerializedProperty property, T attribute)
        {
            if (property.propertyType != SerializedPropertyType.String)
            {
                MightyGUIUtilities.DrawPropertyField(property);
                MightyGUIUtilities.DrawHelpBox($"{attribute.GetType()} can be used only on string fields");
                return;
            }

            if (!m_pathCache.Contains(mightyMember))
            {
                EnableDrawer(mightyMember, attribute);
            }
            var defaultPath = m_pathCache[mightyMember].Value;

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PropertyField(property);
            if (MightyGUIUtilities.DrawButton("...", GUILayout.Width(35)))
            {
                var value = property.stringValue;

                value = DisplayPanel(property.displayName, !string.IsNullOrWhiteSpace(value)
                    ? FileUtilities.GetDirectoryPath(value) ?? value
                    : defaultPath, mightyMember, attribute);

                if (!string.IsNullOrWhiteSpace(value))
                {
                    property.stringValue = value;
                }
            }

            EditorGUILayout.EndHorizontal();
        }
示例#3
0
        public static void DrawTagField(SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.String)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"\"{property.displayName}\" should be of type string");
                return;
            }

            string tag;

            if (options.Contains(FieldOption.HideLabel))
            {
                tag = EditorGUILayout.TagField(property.stringValue);
            }
            else if (options.Contains(FieldOption.BoldLabel))
            {
                tag = EditorGUILayout.TagField(label ?? EditorGUIUtility.TrTextContent(property.displayName), property.stringValue,
                                               EditorStyles.boldLabel);
            }
            else
            {
                tag = EditorGUILayout.TagField(label ?? EditorGUIUtility.TrTextContent(property.displayName), property.stringValue);
            }

            property.stringValue = tag;
        }
示例#4
0
        public static void DrawTagField(Rect position, SerializedProperty property, FieldOption options)
        {
            if (property.propertyType != SerializedPropertyType.String)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"\"{property.displayName}\" should be of type string");
                return;
            }

            string tag;

            if (options.Contains(FieldOption.HideLabel))
            {
                tag = EditorGUI.TagField(position, property.stringValue);
            }
            else if (options.Contains(FieldOption.BoldLabel))
            {
                tag = EditorGUI.TagField(position, property.displayName, property.stringValue, EditorStyles.boldLabel);
            }
            else
            {
                tag = EditorGUI.TagField(position, property.displayName, property.stringValue);
            }

            property.stringValue = tag;
        }
示例#5
0
        public void DrawSlider(SerializedProperty property, PercentSliderAttribute attribute, GUIContent label = null)
        {
            switch (property.propertyType)
            {
            case SerializedPropertyType.Integer:
                GUILayout.BeginHorizontal();

                if (attribute.Options.Contains(FieldOption.HideLabel))
                {
                    property.intValue = EditorGUILayout.IntSlider(property.intValue, 0, 100);
                }
                else if (label != null)
                {
                    property.intValue = EditorGUILayout.IntSlider(label, property.intValue, 0, 100);
                }
                else
                {
                    property.intValue = EditorGUILayout.IntSlider(property.displayName, property.intValue, 0, 100);
                }

                GUILayout.Label("%", GUILayout.Width(15));
                GUILayout.EndHorizontal();
                break;

            case SerializedPropertyType.Float:
                GUILayout.BeginHorizontal();

                var value = attribute.Between01 ? property.floatValue * 100 : property.floatValue;

                if (attribute.Options.Contains(FieldOption.HideLabel))
                {
                    value = EditorGUILayout.Slider(value, 0, 100);
                }
                else if (label != null)
                {
                    value = EditorGUILayout.Slider(label, value, 0, 100);
                }
                else
                {
                    value = EditorGUILayout.Slider(property.displayName, value, 0, 100);
                }

                property.floatValue = attribute.Between01 ? value / 100 : value;

                GUILayout.Label("%", GUILayout.Width(15));
                GUILayout.EndHorizontal();
                break;

            default:
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{nameof(PercentSliderAttribute)} can be used only on int and float fields");
                break;
            }
        }
示例#6
0
        private void DrawAssetField(Rect position, SerializedProperty property, AssetOnlyAttribute attribute)
        {
            if (property.propertyType != SerializedPropertyType.ObjectReference)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{property.name} should be of type UnityEngine.Object");
                return;
            }

            property.objectReferenceValue = attribute.Options.Contains(FieldOption.HideLabel)
                ? EditorGUI.ObjectField(position, property.objectReferenceValue, property.GetSystemType(), false)
                : EditorGUI.ObjectField(position, property.displayName, property.objectReferenceValue, property.GetSystemType(), false);
        }
示例#7
0
        public void DrawTextArea(Rect position, SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.String)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{nameof(ResizableTextAreaAttribute)} can only be used on string fields");
                return;
            }

            DrawLabel(ref position, property, options, label);

            position.height      = MightyGUIUtilities.TextHeight(property.stringValue, 3);
            property.stringValue = EditorGUI.TextArea(position, property.stringValue);
        }
示例#8
0
        private void DrawAssetField(SerializedProperty property, AssetOnlyAttribute attribute, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.ObjectReference)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{property.name} should be of type UnityEngine.Object");
                return;
            }

            property.objectReferenceValue = attribute.Options.Contains(FieldOption.HideLabel)
                ? EditorGUILayout.ObjectField(property.objectReferenceValue, property.GetSystemType(), false)
                : EditorGUILayout.ObjectField(label ?? EditorGUIUtility.TrTextContent(property.displayName),
                                              property.objectReferenceValue, property.GetSystemType(), false);
        }
示例#9
0
        public void DrawTextArea(SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                DrawLabel(property, options, label);

                property.stringValue = EditorGUILayout.TextArea(property.stringValue,
                                                                GUILayout.Height(MightyGUIUtilities.TextHeight(property.stringValue, 3)));
            }
            else
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{nameof(ResizableTextAreaAttribute)} can only be used on string fields");
            }
        }
示例#10
0
        public void DrawSlider(Rect position, SerializedProperty property, PercentSliderAttribute attribute)
        {
            switch (property.propertyType)
            {
            case SerializedPropertyType.Integer:

                position.width -= 15;
                if (attribute.Options.Contains(FieldOption.HideLabel))
                {
                    property.intValue = EditorGUI.IntSlider(position, property.intValue, 0, 100);
                }
                else
                {
                    property.intValue = EditorGUI.IntSlider(position, property.displayName, property.intValue, 0, 100);
                }

                position.x += position.width;
                GUI.Label(position, "%");
                break;

            case SerializedPropertyType.Float:

                var value = attribute.Between01 ? property.floatValue * 100 : property.floatValue;

                position.width -= 15;
                if (attribute.Options.Contains(FieldOption.HideLabel))
                {
                    value = EditorGUI.Slider(position, value, 0, 100);
                }
                else
                {
                    value = EditorGUI.Slider(position, property.displayName, value, 0, 100);
                }

                property.floatValue = attribute.Between01 ? value / 100 : value;

                position.x += position.width;
                GUI.Label(position, "%");
                break;

            default:
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position,
                                               $"{nameof(PercentSliderAttribute)} can be used only on int and float fields");
                break;
            }
        }
示例#11
0
        private void DrawRotation2D(Rect position, SerializedProperty property, Rotation2DAttribute attribute)
        {
            if (property.propertyType != SerializedPropertyType.Quaternion)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{property.name} should be of type Quaternion");
                return;
            }

            var angles = property.quaternionValue.eulerAngles;

            angles.z = attribute.Options.Contains(FieldOption.HideLabel)
                ? EditorGUI.Slider(position, angles.z, 0, 359.9f)
                : EditorGUI.Slider(position, property.displayName, angles.z, 0, 359.9f);

            property.quaternionValue = Quaternion.Euler(angles);
        }
示例#12
0
        private void DrawRotation2D(SerializedProperty property, Rotation2DAttribute attribute, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.Quaternion)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{property.name} should be of type Quaternion");
                return;
            }

            var angles = property.quaternionValue.eulerAngles;

            angles.z = attribute.Options.Contains(FieldOption.HideLabel)
                ? EditorGUILayout.Slider(angles.z, 0, 359.9f)
                : EditorGUILayout.Slider(label ?? EditorGUIUtility.TrTextContent(property.displayName), angles.z, 0, 359.9f);

            property.quaternionValue = Quaternion.Euler(angles);
        }
示例#13
0
        private static void DrawEuler(SerializedProperty property, EulerAttribute attribute, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.Quaternion)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{property.name} should be of type Quaternion");
                return;
            }

            if (attribute.Options.Contains(FieldOption.HideLabel))
            {
                MightyGUIUtilities.DrawRotationEuler(GUIContent.none, property);
            }
            else
            {
                MightyGUIUtilities.DrawRotationEuler(label ?? EditorGUIUtility.TrTextContent(property.displayName), property);
            }
        }
示例#14
0
        private void DrawField(Rect position, SerializedProperty property, FieldOption options)
        {
            if (!IsPropertyTypeValid(property.propertyType))
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{property.name} should be of type {TypeName}");
                return;
            }

            EditorGUI.BeginChangeCheck();

            var values = DrawMultiField(position, EditorGUIUtility.TrTextContent(property.displayName), GetValues(property), options);

            if (EditorGUI.EndChangeCheck())
            {
                SetValues(property, values);
            }
        }
示例#15
0
        private static void DrawEuler(Rect position, SerializedProperty property, EulerAttribute attribute)
        {
            if (property.propertyType != SerializedPropertyType.Quaternion)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{property.name} should be of type Quaternion");
                return;
            }

            if (attribute.Options.Contains(FieldOption.HideLabel))
            {
                MightyGUIUtilities.DrawRotationEuler(position, GUIContent.none, property);
            }
            else
            {
                MightyGUIUtilities.DrawRotationEuler(position, property);
            }
        }
示例#16
0
        public void DrawSlider(SerializedProperty property, FieldOption option, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{nameof(SceneSliderAttribute)} can be used only on int fields");
                return;
            }

            var max = SceneManager.sceneCountInBuildSettings - 1;

            property.intValue = option.Contains(FieldOption.HideLabel)
                ? EditorGUILayout.IntSlider(property.intValue, 0, max)
                : EditorGUILayout.IntSlider(label ?? EditorGUIUtility.TrTextContent(property.displayName), property.intValue, 0, max);

            EditorGUILayout.LabelField(Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(property.intValue)),
                                       EditorStyles.boldLabel);
        }
示例#17
0
        private static void DrawDropdown(SerializedProperty property, FieldOption option, GUIContent label = null)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{nameof(SceneDropdownAttribute)} can be used only on int fields");
                return;
            }

            GetDisplayOptions(out var displayOptions, out var values);

            var value = MightyGUIUtilities.DrawDropdown(label ?? EditorGUIUtility.TrTextContent(property.displayName), property.intValue,
                                                        values, displayOptions, option);

            if (value != null)
            {
                property.intValue = (int)value;
            }
        }
示例#18
0
        public void DrawArray(MightySerializedField serializedField, T attribute, IArrayElementDrawer drawer,
                              BasePropertyDrawerAttribute drawerAttribute)
        {
            var property = serializedField.Property;

            if (!property.IsCollection())
            {
                MightyGUIUtilities.DrawHelpBox($"{attribute.GetType().Name} can be used only on arrays or lists");

                MightyGUIUtilities.DrawPropertyField(property);
                return;
            }

            var options = GetOptionsForMember(serializedField, attribute);

            var decoratorAttributes = GetDecorationsForMember(serializedField, attribute);

            DrawArrayImpl(serializedField, attribute, options, decoratorAttributes, drawer, drawerAttribute);
        }
示例#19
0
        private void DrawField(SerializedProperty property, FieldOption options, GUIContent label = null)
        {
            if (!IsPropertyTypeValid(property.propertyType))
            {
                MightyGUIUtilities.DrawPropertyField(property, label);
                MightyGUIUtilities.DrawHelpBox($"{property.name} should be of type {TypeName}");
                return;
            }

            EditorGUI.BeginChangeCheck();

            var values = DrawMultiField(EditorGUILayout.GetControlRect(true, GetFieldHeight(options)),
                                        label ?? EditorGUIUtility.TrTextContent(property.displayName), GetValues(property), options);

            if (EditorGUI.EndChangeCheck())
            {
                SetValues(property, values);
            }
        }
示例#20
0
        private static void DrawDropdown(Rect position, SerializedProperty property, FieldOption option)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{nameof(SceneDropdownAttribute)} can be used only on int fields");
                return;
            }

            GetDisplayOptions(out var displayOptions, out var values);

            var value = MightyGUIUtilities.DrawDropdown(position, property.displayName, property.intValue,
                                                        values, displayOptions, option);

            if (value != null)
            {
                property.intValue = (int)value;
            }
        }
示例#21
0
        public void DrawSlider(Rect position, SerializedProperty property, FieldOption option)
        {
            if (property.propertyType != SerializedPropertyType.Integer)
            {
                position = MightyGUIUtilities.DrawPropertyField(position, property);
                MightyGUIUtilities.DrawHelpBox(position, $"{nameof(SceneSliderAttribute)} can be used only on int fields");
                return;
            }

            var max = SceneManager.sceneCountInBuildSettings - 1;

            position.height = MightyGUIUtilities.FIELD_HEIGHT;

            property.intValue = option.Contains(FieldOption.HideLabel)
                ? EditorGUI.IntSlider(position, property.intValue, 0, max)
                : EditorGUI.IntSlider(position, property.displayName, property.intValue, 0, max);

            position = MightyGUIUtilities.JumpLine(position, false);

            EditorGUI.LabelField(position, Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(property.intValue)),
                                 EditorStyles.boldLabel);
        }
示例#22
0
 protected override void DrawProperty(MightySerializedField mightyMember, SerializedProperty property, NoLabelAttribute attribute) =>
 MightyGUIUtilities.DrawPropertyField(property, GUIContent.none);
示例#23
0
        private void DrawSerializedField(MightySerializedField serializedField)
        {
            if ((hideStatus & HideStatus.SerializedFields) == HideStatus.SerializedFields)
            {
                return;
            }

            var hasDecorations = serializedField.TryGetAttributes(out BaseGlobalDecoratorAttribute[] decoratorAttributes);

            if (serializedField.TryGetAttribute(out BaseShowConditionAttribute showConditionAttribute))
            {
                var canDraw = ((IShowConditionDrawer)showConditionAttribute.Drawer).CanDraw(serializedField, showConditionAttribute);

                if (!canDraw)
                {
                    if (!hasDecorations)
                    {
                        return;
                    }

                    foreach (var attribute in decoratorAttributes)
                    {
                        if (!(attribute is IDrawAnywhereAttribute drawAnywhereAttribute))
                        {
                            continue;
                        }

                        ((IDrawAnywhereDecorator)attribute.Drawer).BeginDrawAnywhere(serializedField,
                                                                                     drawAnywhereAttribute);
                    }


                    for (var i = decoratorAttributes.Length - 1; i >= 0; i--)
                    {
                        if (!(decoratorAttributes[i] is IDrawAnywhereAttribute drawAnywhereAttribute))
                        {
                            continue;
                        }

                        ((IDrawAnywhereDecorator)decoratorAttributes[i].Drawer).EndDrawAnywhere(serializedField,
                                                                                                drawAnywhereAttribute);
                    }

                    return;
                }
            }

            var hasArrayAttribute  = serializedField.TryGetAttribute(out BaseArrayAttribute arrayAttribute);
            var hasChangeChecks    = serializedField.TryGetAttributes(out BaseChangeCheckAttribute[] changeCheckAttributes);
            var hasValidators      = serializedField.TryGetAttributes(out BaseValidatorAttribute[] validatorAttributes);
            var hasDrawerAttribute = serializedField.TryGetAttribute(out BasePropertyDrawerAttribute drawerAttribute);
            var hasEnableCondition = serializedField.TryGetAttribute(out BaseEnableConditionAttribute enableConditionAttribute);

            var decoratorsLength = hasDecorations ? decoratorAttributes.Length : 0;

            var lastArrayDecoratorIndex = -1;

            var isPropertyCollection = serializedField.Property.IsCollection();

            if (isPropertyCollection)
            {
                for (var i = decoratorsLength - 1; i >= 0; i--)
                {
                    if (!(decoratorAttributes[i] is BaseArrayDecoratorAttribute))
                    {
                        continue;
                    }

                    lastArrayDecoratorIndex = i;
                    break;
                }
            }

            if (hasDecorations)
            {
                for (var i = 0; i < decoratorsLength; i++)
                {
                    switch (decoratorAttributes[i])
                    {
                    case BaseArrayDecoratorAttribute arrayDecoratorAttribute
                        when(!hasArrayAttribute && (!isPropertyCollection || i != lastArrayDecoratorIndex)):
                        ((IArrayDecoratorDrawer)arrayDecoratorAttribute.Drawer).BeginDrawMember(serializedField, arrayDecoratorAttribute, null);

                        break;

                    case BaseDecoratorAttribute decoratorAttribute:
                        ((IDecoratorDrawer)decoratorAttribute.Drawer).BeginDraw(serializedField,
                                                                                decoratorAttribute);
                        break;
                    }
                }
            }


            if (hasEnableCondition)
            {
                ((IEnableConditionDrawer)enableConditionAttribute.Drawer).BeginEnable(serializedField, enableConditionAttribute);
            }

            EditorGUI.BeginChangeCheck();
            if (hasChangeChecks)
            {
                foreach (var attribute in changeCheckAttributes)
                {
                    ((IChangeCheckDrawer)attribute.Drawer).BeginChangeCheck(serializedField, attribute);
                }
            }

            if (!hasArrayAttribute)
            {
                var propertyDrawCallback = hasDrawerAttribute
                    ? new PropertyDrawCallback((mightyMember, property, baseAttribute) =>
                                               ((IPropertyDrawer)drawerAttribute.Drawer).DrawProperty(mightyMember, property,
                                                                                                      baseAttribute))
                    : (_, property, __) => MightyGUIUtilities.DrawPropertyField(property);

                if (lastArrayDecoratorIndex != -1)
                {
                    var lastAttribute = (BaseArrayDecoratorAttribute)decoratorAttributes[lastArrayDecoratorIndex];
                    var lastDecorator = (IArrayDecoratorDrawer)lastAttribute.Drawer;

                    lastDecorator.BeginDrawMember(serializedField, lastAttribute, propertyDrawCallback, drawerAttribute);
                    lastDecorator.EndDrawMember(serializedField, lastAttribute, propertyDrawCallback, drawerAttribute);
                }
                else
                {
                    propertyDrawCallback(serializedField, serializedField.Property, drawerAttribute);
                }
            }
            else
            {
                ((IArrayDrawer)arrayAttribute.Drawer).DrawArray(serializedField, arrayAttribute,
                                                                drawerAttribute?.Drawer as IArrayElementDrawer, drawerAttribute);
            }

            if (hasValidators)
            {
                foreach (var attribute in validatorAttributes)
                {
                    ((IValidatorDrawer)attribute.Drawer).ValidateProperty(serializedField, attribute);
                }
            }

            var changed = EditorGUI.EndChangeCheck() || MightyEditorUtilities.HasEditorChanged();

            if (hasChangeChecks)
            {
                if (hasChangeChecks)
                {
                    foreach (var attribute in changeCheckAttributes)
                    {
                        ((IChangeCheckDrawer)attribute.Drawer).EndChangeCheck(changed, serializedField,
                                                                              attribute);
                    }
                }
            }

            if (hasEnableCondition)
            {
                ((IEnableConditionDrawer)enableConditionAttribute.Drawer).EndEnable(serializedField,
                                                                                    enableConditionAttribute);
            }

            if (hasDecorations)
            {
                for (var i = decoratorsLength - 1; i >= 0; i--)
                {
                    switch (decoratorAttributes[i])
                    {
                    case BaseArrayDecoratorAttribute arrayDecoratorAttribute
                        when(!hasArrayAttribute && (!isPropertyCollection || i != lastArrayDecoratorIndex)):
                        ((IArrayDecoratorDrawer)arrayDecoratorAttribute.Drawer).EndDrawMember(
                            serializedField, (BaseArrayDecoratorAttribute)decoratorAttributes[i], null);

                        break;

                    case BaseDecoratorAttribute decoratorAttribute:
                        ((IDecoratorDrawer)decoratorAttribute.Drawer).EndDraw(serializedField,
                                                                              (BaseDecoratorAttribute)decoratorAttributes[i]);
                        break;
                    }
                }
            }
        }
示例#24
0
        protected override void DrawArrayImpl(MightySerializedField serializedField, ReorderableListAttribute attribute, ArrayOption options,
                                              BaseArrayDecoratorAttribute[] decoratorAttributes, IArrayElementDrawer drawer, BasePropertyDrawerAttribute drawerAttribute)
        {
            var property = serializedField.Property;

            EditorGUILayout.BeginVertical();

            foreach (var decoratorAttribute in decoratorAttributes)
            {
                ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).BeginDrawArray(serializedField, decoratorAttribute);
            }

            if (!options.Contains(ArrayOption.HideLabel) && !options.Contains(ArrayOption.LabelInHeader))
            {
                foreach (var decoratorAttribute in decoratorAttributes)
                {
                    ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).BeginDrawHeader(serializedField, decoratorAttribute);
                }

                if (options.Contains(ArrayOption.DontFold))
                {
                    EditorGUILayout.LabelField(property.displayName,
                                               options.Contains(ArrayOption.BoldLabel) ? EditorStyles.boldLabel : EditorStyles.label);
                    property.isExpanded = true;
                }
                else if (!MightyGUIUtilities.DrawFoldout(property,
                                                         options.Contains(ArrayOption.BoldLabel) ? MightyStyles.BoldFoldout : null))
                {
                    EditorGUILayout.EndVertical();

                    foreach (var decoratorAttribute in decoratorAttributes)
                    {
                        ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).EndDrawHeader(serializedField, decoratorAttribute);
                    }

                    foreach (var decoratorAttribute in decoratorAttributes)
                    {
                        ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).EndDrawArray(serializedField, decoratorAttribute);
                    }

                    return;
                }

                foreach (var decoratorAttribute in decoratorAttributes)
                {
                    ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).EndDrawHeader(serializedField, decoratorAttribute);
                }
            }
            else
            {
                property.isExpanded = true;
            }

            if (!options.Contains(ArrayOption.DontIndent))
            {
                m_indentCache[serializedField] = EditorGUI.indentLevel;
                MightyGUIUtilities.BeginLayoutIndent();
                EditorGUI.indentLevel = 0;
                EditorGUILayout.BeginVertical();
            }

            if (!m_reorderableCache.Contains(serializedField))
            {
                ReorderableList reorderableList = new ReorderableList(property.serializedObject, property,
                                                                      attribute.Draggable, options.Contains(ArrayOption.LabelInHeader) || !options.Contains(ArrayOption.HideSizeField),
                                                                      attribute.DrawButtons, attribute.DrawButtons)
                {
                    drawHeaderCallback = position =>
                    {
                        var labelWidth = EditorGUIUtility.labelWidth;

                        if (options.Contains(ArrayOption.LabelInHeader))
                        {
                            var labelSpace = Screen.width - WIDTH_OVERFLOW - SIZE_FIELD_WIDTH - SIZE_LABEL_WIDTH;
                            position.width = labelSpace - SPACE;
                            if (options.Contains(ArrayOption.BoldLabel))
                            {
                                EditorGUI.LabelField(position, property.displayName, EditorStyles.boldLabel);
                            }
                            else
                            {
                                EditorGUI.LabelField(position, property.displayName);
                            }

                            position.x     = labelSpace;
                            position.width = SIZE_FIELD_WIDTH + SIZE_LABEL_WIDTH;
                            EditorGUIUtility.labelWidth = SIZE_LABEL_WIDTH;
                        }

                        if (!options.Contains(ArrayOption.HideSizeField))
                        {
                            var enabled = GUI.enabled;
                            GUI.enabled = !options.Contains(ArrayOption.DisableSizeField);

                            MightyGUIUtilities.DrawArraySizeField(position, property);
                            GUI.enabled = enabled;
                        }

                        EditorGUIUtility.labelWidth = labelWidth;
                    },

                    drawElementCallback = (position, index, isActive, isFocused) =>
                    {
                        position.y += 2;

                        foreach (var decoratorAttribute in decoratorAttributes)
                        {
                            position = ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).BeginDrawElement(position, serializedField, index, decoratorAttribute);
                        }

                        if (drawer != null)
                        {
                            var height = drawer.GetElementHeight(serializedField, index, drawerAttribute);
                            position.height = height;
                            drawer.DrawElement(position, serializedField, index, drawerAttribute);
                            position = MightyGUIUtilities.JumpHeight(position, height);
                        }
                        else if (options.Contains(ArrayOption.HideElementLabel))
                        {
                            position = MightyGUIUtilities.DrawPropertyField(position, property.GetArrayElementAtIndex(index),
                                                                            GUIContent.none);
                        }
                        else
                        {
                            position = MightyGUIUtilities.DrawPropertyField(position, property.GetArrayElementAtIndex(index));
                        }

                        foreach (var decoratorAttribute in decoratorAttributes)
                        {
                            position = ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).EndDrawElement(position, serializedField, index, decoratorAttribute);
                        }
                    },

                    elementHeightCallback = index => GetElementHeight(serializedField, attribute, drawer, drawerAttribute, index),
                    headerHeight          = MightyGUIUtilities.FIELD_HEIGHT + MightyGUIUtilities.FIELD_SPACING
                };

                m_reorderableCache[serializedField] = reorderableList;
            }

            m_reorderableCache[serializedField].DoLayoutList();

            if (!options.Contains(ArrayOption.DontIndent))
            {
                EditorGUI.indentLevel = m_indentCache[serializedField];
                MightyGUIUtilities.EndLayoutIndent();
                EditorGUILayout.EndVertical();
            }

            foreach (var decoratorAttribute in decoratorAttributes)
            {
                ((IArrayDecoratorDrawer)decoratorAttribute.Drawer).EndDrawArray(serializedField, decoratorAttribute);
            }

            EditorGUILayout.EndVertical();
        }