Scriptable Object Factory

Scriptable Object Factory - Article - Tal Lior

ScriptableObjectFactory Unity Package Download Link - Dropbox

ScriptableObjectFactory Link - Box.com

Any class that inherits from ScriptableObject will now show up as an option in the Project Assets Menu:

The image below shows that the Scriptable Object Factory places a new folder: Editor, with 2 scripts: ScriptableObjectFactory.cs, ScriptableObjectWindow.cs.

  • Add a public instance of the Scriptable Object to a custom script that will be attached to a gameObject in a scene. In our case this is the DialogManager.cs script.

    public class DialogManager : MonoBehaviour {
    
       public ConversationList convList; //attach scriptable object in Inspector
    
       //more class definition code below
  • Use inspector to select a ConversationList scriptableObject from your project's assets, to populate the convList variable defined above.

Scriptable Objects are amazing data containers. They don't need to be attached to a GameObject in a scene. They can be saved as assets in our project. Most often, they are used as assets which are only meant to store data, but can also be used to help serialize objects and can be instantiated in our scenes. Adam Buckner - Official Unity Tutorial

Scriptable Objects - Unity Manual, Scripting API

ScriptableObject is a class that allows you to store large quantities of shared data independent from script instances.

A class you can derive from if you want to create objects that don't need to be attached to game objects. This is most useful for assets which are only meant to store data.

Last updated