Wiring the host
UnityGnosisEngine component
Add UnityGnosisEngine to a scene object that should live for the whole session (often a bootstrap / systems object).
-
Service entries — For each engine service your build registers, add a row:
serviceIdmust match the service’sId(e.g.UserInterface,Money).lifetimePermanent vs Ephemeral must match the C# service’sGnosisLifetime.- Adapter binding —
None, scene reference (UnityGnosisAdapterin hierarchy), or runtime prefab (spawned when the service binds).
-
UnityAssetRegistry— Assign your registry asset so ids in data resolve to Unity objects. -
Run flow — Your menus / run coordinator should call the host’s public APIs to start, pause, resume, end runs (exact method names live on
UnityGnosisEngine; they orchestrate ephemeral service lifetime and save hooks).
GnosisEngineBehaviour
For arbitrary MonoBehaviours that need the engine, inherit GnosisEngineBehaviour instead of MonoBehaviour:
- Resolves
UnityGnosisEngine.Instance(orFindObjectOfTypefallback). - Retries until the underlying
GnosisEngineexists, then callsOnEngineReady()once. - Provides
GetAdapter<T>(),GetServiceById, etc.
Use this when a scene object must react to services without manual null checks everywhere.
Static instance
UnityGnosisEngine.Instance is set by the host—prefer dependency flow through explicit references or GnosisEngineBehaviour in new code; static access is convenient but harder to test.
Next: Adapters.