Today I found that you can use the CreateAssetMenu attribute to mark a ScriptableObject as something that should appear in the Create/Asset menu, just like the CreateScriptableObjectAsset from the Unify Wiki. It’s great that we have this functionality built in now, but there are some problems:
The attribute places the button at the top of the Create/Asset menu, where Create/Asset/Folder should go, instead of placing at the bottom of the menu.
The constructor for the attribute does not provide ways to set the menuName, fileName, or order variables, so you cannot change the name of the entry on the Create/Asset menu or the order (which is why it appears on top). Because of this you also cannot nest things in submenus.
The CreateAssetMenuAttribute is also sealed, so it cannot be inherited from to add this functionality.
public class CreateMenuAttribute : CreateAssetMenuAttribute
{
public CreateMenuAttribute(string menuName) : base()
{
this.menuName = menuName;
}
public CreateMenuAttribute(string menuName, int order) : base()
{
this.menuName = menuName;
this.order = order;
}
}
Assets/Scripts/Utility/CreateMenuAttribute.cs(4,14): error CS0509: `CreateMenuAttribute': cannot derive from sealed type `UnityEngine.CreateAssetMenuAttribute'
Is there a way to add this functionality? Can you create a C# attribute that adds and manages another attribute? Doing it with the attribute is much better than having to make a CreateMenu method for every class.