Unity-SerializeReferenceExtensions icon indicating copy to clipboard operation
Unity-SerializeReferenceExtensions copied to clipboard

[FEATURE] `[HideSubClass]` attribute

Open Antoshidza opened this issue 1 year ago • 0 comments

Feature destription

There are some cases where I want to select subclasses of ICardActionCommand directly, where I can create ready to use instance from inspector, but sometimes I need to use Config classes which would be selected as subclasses of IConfigurator<T>. I want to suppress in that cases selecting original class from subclass menu. It is possible to remove [Serializable] from it, but there are also cases where [Serializable] is required for some other logic like saving.

// in this example I want my DeferredCardActionCommand to be NOT selectable as subclass of ICardActionCommand
[Serializable]
public readonly struct DeferredCardActionCommand : ICardActionCommand
    {
        [Serializable, AddTypeMenu("Cards/Deferred card action")]
        private class Config : IConfigurator<ICommand>
        {
            // impl
        }
        
        // impl
    }

Antoshidza avatar Sep 25 '24 09:09 Antoshidza