Fast ScriptableObject Creation in Unity

ScriptableObjects can be a very useful feature of Unity but they’re a hassle to create. Here’s a way to do this quickly:

Scriptable Object Context Menu

Scriptable Object Context Menu

In the stock interface there is no way to create ScriptableObjects. Most solutions I found solve this by adding a MenuItem to the top bar. This item then creates a ScriptableObject .asset file of a specific class. This is works but it requires you to adjust the script for each project so it points to a class of that pr oject. It also requires you to create a specific script for each of your classes, even if that might otherwise not be neccessary.

Our ScriptableObjectContextEditor script avoids these problems. Instead of the clumsy menu, it allows you to create .asset files directy from the project pane, where you’d expect it. Not only that, it also has an implementation that allows you to select a script file from which to create an asset, so you don’t need to adjust the script for each project. However if you want to do that you can make use of a generic function provided to create additional pulldown options for specific classes of your own.

3 thoughts on “Fast ScriptableObject Creation in Unity

  1. You can easily use Resources.FindObjectsOfTypeAll to find all scriptable objects and list them, instead of making the user manually select one.

    • That’s true. Or the AssetDatabase.FindAssets method. However that would require to manually create a popup or window where you select from the found ScriptableObjects and that was just a bit too much work at that moment ;)


Leave a Reply

Your email address will not be published. Required fields are marked *

To fight spam your IP at the time of commenting is saved together with your comment.