// 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; /// /// When applied to a /// subclass, enables automatic cleanup of duplicate singleton assets during editor initialization. /// /// /// /// Duplicate singleton assets can occur when: /// /// A path is changed /// Assets are manually copied or the package is re-imported /// Migration from an older path structure creates new assets without removing old ones /// /// /// /// When this attribute is present, the ScriptableObjectSingletonCreator will: /// /// Identify the canonical asset path based on the current /// Find all other assets of the same type under Assets/Resources /// Compare duplicate assets to the canonical asset using Unity's serialization /// Delete duplicates that have identical serialized content /// Attempt to delete empty parent folders left behind /// /// /// /// Without this attribute, duplicates will only generate a warning in the console. /// /// /// /// /// [ScriptableSingletonPath("Wallstop Studios")] /// [AllowDuplicateCleanup] /// public sealed class MySettings : ScriptableObjectSingleton<MySettings> /// { /// // Settings fields... /// } /// /// [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] public sealed class AllowDuplicateCleanupAttribute : Attribute { } }