This skill shows an agent how to use ScriptableObject assets in Unity 6.3 LTS for shared data and for decoupling systems. It covers CreateAssetMenu config assets, runtime variables that reset when Play mode starts, event channels, and creating .asset files from editor code so Unity writes a valid GUID.
It also lists the traps: Play mode edits that persist in the Editor, OnEnable resets that stop working when Reload Domain is off, renamed fields that wipe data, and assets stripped from a build because nothing references them.
What You Get
- A six-step workflow from class definition to verification
- Patterns for a weapon data config asset, a float variable with a Play mode reset, and an editor script that creates assets
- An event channel reference with listeners, typed payloads and a runtime set that replaces FindObjectsByType scans
- Verification routes that read the .asset YAML, query the Editor through the Unity CLI, or run EditMode tests
- A gotcha list covering Play mode persistence, Reload Domain off, FormerlySerializedAs and stripped assets
Common Use Cases
- Replacing a singleton game manager with shared variable assets
- Making weapons, items or cards data-driven so designers edit them in the Inspector
- Wiring the HUD, audio and respawner to a player-died event without direct references
- Finding why a value changed after leaving Play mode
What Makes It Unique
The skill treats a ScriptableObject asset as a YAML file the agent can read and check without opening the Editor, and it tells the agent never to hand-write a new .asset because the script GUID must match the .meta file. It also covers the Reload Domain off case that breaks the usual OnEnable reset, which many tutorials skip.
Under The Hood
The agent loads the SKILL.md and reads the event channels reference only when it adds an event channel or runtime set. It writes C# scripts into your project, including editor scripts that create asset files, and it can run them through the Unity command line tool, batch mode or a menu item. To verify it greps the .asset YAML files, runs the project checker from the unity-csharp-scripting skill, and can query a ready Editor. It does not fetch web pages or call outside services.