// MIT License - Copyright (c) 2025 wallstop // Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE namespace WallstopStudios.UnityHelpers.Core.Attributes { using System; using UnityEngine; /// /// Controls whether SerializableDictionary and SerializableSet inspectors start expanded. /// [AttributeUsage(AttributeTargets.Field)] public sealed class WSerializableCollectionFoldoutAttribute : PropertyAttribute { public WSerializableCollectionFoldoutAttribute( WSerializableCollectionFoldoutBehavior behavior = WSerializableCollectionFoldoutBehavior.StartCollapsed ) { Behavior = behavior; } /// /// Requested default foldout behavior for the decorated collection field. /// public WSerializableCollectionFoldoutBehavior Behavior { get; } /// /// Convenience accessor for inspectors that only need an expanded flag. /// public bool StartExpanded => Behavior == WSerializableCollectionFoldoutBehavior.StartExpanded; } /// /// Available foldout states for SerializableDictionary/SerializableSet inspectors. /// public enum WSerializableCollectionFoldoutBehavior { StartCollapsed = 0, StartExpanded = 1, } }