Skip to Content
ArchitectureEngine lifecycle

Engine lifecycle

The core type is GnosisEngine (Core/Engine/GnosisEngine.cs). It does not know Unity; UnityGnosisEngine constructs it and drives timing.

Phases

  1. InitializePermanentOnly — Builds a fresh root GnosisState, creates permanent services from config, calls Initialize on each. Ephemeral services do not exist yet.
  2. InitializeNonPermanentServices — When a run starts, creates ephemeral services and initializes them.
  3. StartRun / EndRun — Notifies services in order: StartRun calls OnRunStarted on permanent services, then ephemeral; EndRun calls OnRunEnded on ephemeral first, then permanent.
  4. DestroyNonPermanentServices — Shuts down and clears ephemeral instances when leaving a run.
  5. Shutdown — Full teardown including permanent services.

What you get from the engine object

  • EventBus — Publish/subscribe and rule processing (IGnosisEventBus).
  • Store — The GnosisStore backing all nodes; use this store when building GnosisNode payloads so handles stay valid.
  • State — Current GnosisState (invalid until initialized).
  • GetService(id) — Resolve a service; includes a legacy alias UIUserInterface.
  • CallFunction — Cross-service calls with communication policy checks.
  • RunInvocationList — Execute JSON-shaped { service, function, parameters } chains (used by boons, consumables, etc.).

Config object

Services are registered through GnosisEngineConfig (factories + lifetime). In Unity, that list is mirrored by GnosisEngineServiceEntry rows on the host component.

If you add a new first-party style service, you extend both the C# registration (however your project builds GnosisEngineConfig) and the inspector entries so adapters bind correctly.

Next: State & GnosisStore.

Last updated on