ScriptableObjects

A ScriptableObject is a data class that becomes a FILE in your project — editable in the Inspector, reusable everywhere, with no scene attached. It is Unity's way of saying "content is data," and it is the pipeline behind every card in the card jam.

The definition, and the two-line comparison

A MonoBehaviour lives ON a scene object and runs code in the frame loop (Start, Update). A ScriptableObject lives IN the project as an asset and holds values — nothing more. You do not add it to a GameObject; you create instances in Assets and reference them.

MonoBehaviourScriptableObject
Attached toGameObject in a sceneNothing — it IS an asset (.asset file)
Lifecycle methodsStart, Update, collisionsOnEnable at most — no frame loop
Each scene hasits own instancereferences to the SAME asset
Edited inInspector, per scene objectInspector, in the project, everywhere
Your year used it forevery controllerCard data (10.2b)

Writing one

[CreateAssetMenu(menuName = "Cards/New Card")]
public class Card : ScriptableObject
{
    public string cardName;
    public Sprite art;
    public int cost;
    public int attack;
    public int defense;
    public string description;
}

Then: right-click in Assets → Create → Cards → New Card. An .asset file appears; the Inspector shows your fields; you fill them in. That is the whole "pipeline": one class definition, then unlimited data, no further code.

// referencing them — the deck is a list of card ASSETS:
[SerializeField] private List<Card> startingDeck;
// drag card assets into the list in the Inspector. Done.

Assets are referenced, not copied

The subtle, load-bearing fact: when three different hands hold "the same card," memory holds one card object with many references — the same relationship your scene YAML has to sprites by guid (9.4). Consequences, good and bad:

When to reach for one (and when not)

Reach for a ScriptableObject when the data is authored content: many instances, edited by designers, referenced from scenes and lists, and stable across play sessions — cards, weapons, enemy types, level configs, palette definitions (9.2's palette is a candidate). Do NOT use one for live state: current health, this run's coins, a hand's current contents — that belongs to the scene/prefab world (fields on MonoBehaviours) or the singleton that survives scenes (2.1). The rule of thumb: ScriptableObjects are the nouns in the dictionary; MonoBehaviours are the sentences being spoken right now.

The exam connection

The Create PT's rubric wants a list that participates meaningfully. A List of ScriptableObject assets is the most legible version of that in Unity — the list's purpose (a deck) and its content (authored cards) are visible in two Inspector panes, no code spelunking required. The abstraction argument is clean too: one Card class describes ALL cards — that is a data abstraction managing content complexity, in writing, with screenshots (11.1b).

Where you meet ScriptableObjects this year

← Lists & Arrays All docs Unit 11: Create PT →