[CreateAssetMenu] For inherited ScriptableObjects

I have a class Ability that inherits from ScriptableObject. I have dozens of classes that inherit from Ability to implement additional custom functionality.

How can I easily create the assets needed for these grandchildren? Putting [CreateAssetMenu] property on Ability doesn’t work (presumably because the attribute is outside of the class?). Other than manually writing CreateAssetMenu into every single child, is there any other solution? Kinda defeats the point of OOP if I can’t even get this behavior to propagate to child objects.

The CreateAssetMenu attribute creates one specific menu item to create an instance of that specific type. So yes, you have to attach it to every sub class and you probably want to specify a path / unique name for each class.

Attributes are not members and not part of any OOP structure. They are just meta data that is attached to “something”. That something has to directly follow the attribute. So the attribute is not “outside” the class, it’s attached to the class type itself.

Besides the menu item name you can also specify the default file name that should be used when creating an instance and you can also specify the menu item order. Of course this has to be specified for each concrete type you actually want to show up in the create asset menu.