public static int GetItemsPerPage(SerializedProperty collection)
        {
            PackageSettings.ViewSettings settings        = PackageSettings.Settings.GetListSettings(collection);
            PackageSettings.ViewSettings defaultSettings = PackageSettings.Settings.DefaultListSettings;
            int pageSize;

            if (settings == null)
            {
                pageSize = (defaultSettings.UsePages) ? defaultSettings.ItemsPerPage : collection.arraySize;
            }
            else
            {
                pageSize = (settings.UsePages) ? settings.ItemsPerPage : collection.arraySize;
            }

            return(pageSize);
        }
        private static float DrawSettings(Rect position, SerializedProperty property, SerializedProperty collection)
        {
            var listState = ListStates[CollectionDisplay.GetFullPath(collection)];

            if (!listState.EditingSettings)
            {
                return(0);
            }

            Rect startPosition = position;

            position.xMin -= 6;
            position.xMax += 6;

            PackageSettings.ViewSettings settings        = PackageSettings.Settings.GetListSettings(collection);
            PackageSettings.ViewSettings defaultSettings = PackageSettings.Settings.DefaultListSettings;
            int pageSize = (settings == null) ? defaultSettings.ItemsPerPage : settings.ItemsPerPage;

            position.xMin += 7;
            position.xMax -= 7;
            position.y    += 4;

            position.height = EditorStyles.boldLabel.CalcHeight(new GUIContent("List Settings"), position.width);
            UnityEngine.GUI.Label(position, new GUIContent("List Settings"), EditorStyles.boldLabel);
            position.y += position.height;

            bool usePages    = (settings == null) ? defaultSettings.UsePages : settings.UsePages;
            bool newUsePages = EditorGUI.Toggle(position, "Use Page System", usePages);

            position.y += position.height;
            if (usePages != newUsePages)
            {
                if (settings == null)
                {
                    settings = PackageSettings.Settings.AddNewSettings(collection);
                }

                settings.UsePages     = newUsePages;
                listState.CurrentPage = 0;
                EditorUtility.SetDirty(PackageSettings.Settings);
            }

            float fieldHeight = EditorStyles.textField.fixedHeight;

            position.height = EditorGUIUtility.singleLineHeight;
            EditorStyles.textField.fixedHeight = position.height;
            if (newUsePages)
            {
                int newPageSize = EditorGUI.DelayedIntField(position, "Items Per Page", pageSize);
                if (newPageSize < 1)
                {
                    newPageSize = Mathf.Clamp(newPageSize, 1, 100);
                }

                if (newPageSize != pageSize)
                {
                    if (settings == null)
                    {
                        settings = PackageSettings.Settings.AddNewSettings(collection);
                    }

                    settings.ItemsPerPage = newPageSize;
                    listState.CurrentPage = 0;
                    EditorUtility.SetDirty(PackageSettings.Settings);
                }
                position.y += position.height + 4;
            }

            Color settingsColor = (settings == null) ? defaultSettings.Color : settings.Color;
            Color newColor      = EditorGUI.ColorField(position, "List Color", settingsColor);

            if (newColor != settingsColor)
            {
                if (settings == null)
                {
                    settings = PackageSettings.Settings.AddNewSettings(collection);
                }

                settings.Color = newColor;
                EditorUtility.SetDirty(PackageSettings.Settings);
            }
            position.y += position.height + 4;

            EditorStyles.textField.fixedHeight = fieldHeight;
            position.height = 2;
            UnityEngine.GUI.DrawTexture(position, dividerTexture);
            position.y += position.height + 2;
            return(position.y - startPosition.y);
        }