Skip to Content

Configuration

Loads and merges JSON into the shared state tree at startup; owns save slot helpers and run override blobs. Policy: Internal — no Unity adapter; not meant for arbitrary inbound calls from other services (still exposes a small function surface for tooling/overrides).

Code: Runtime/GnosisEngine/Source/Services/Persistent/Configuration/GnosisConfigurationService.cs (large; use outline search). User paths and bundled JSON go through IGnosisHostFileAccess (Unity: UnityGnosisHostFileAccess): CombineUserDataPath, TryReadUserDataText / TryWriteUserDataText, UserDataFileExists, and bundled loaders. Shared with mod discovery and other host features.

State (typical)

AreaBranchPurpose
configuration.*PersistentMerged JSON roots (rules, themes, items, i18n, …)
overrides / lastOverridesPersistentPending / last-applied run override patches
currentSlotId / lastSlotIdPersistentSave-slot tracking (exact key names in source)
Default + user persistent.jsonSeeded by service on init

How it looks in persistent.json

configuration (rules, themes, items, i18n, inputs, …) is merged at load from your data packs — far larger than a doc excerpt. Slot ids and override blobs are ordinary Persistent keys:

persistent.json
{ "Persistent": { "currentSlotId": "slot1", "lastSlotId": "slot1", "overrides": {}, "lastOverrides": {} } }

Use GetOverrides / SetOverrides (see Functions) to inspect or patch overrides at runtime.

Configuration manifest (Resources/Data/configuration.json)

Ship-only JSON (loaded from Resources, not the user save). Declares which data packs become configuration.* roots via the configs array (see source: LoadConfiguredJsonRoots).

shipPersistentPaths

Optional string array of dot paths from the root of persistent.json (for example Persistent.settings.version and Persistent.settings.logLevel). After the service deep-merges the user persistent.json over the Resources default, it copies each listed path again from the Resources default so shipped values win for those keys only. Use this so an update can refresh display metadata, default logging, or similar even when the player already has an older save on disk.

If the key is missing, not an array, or empty, no paths are re-applied that way.

In the real file, configs and shipPersistentPaths are siblings at the top level. The snippets below show each key in isolation so the shape is obvious; combine them into one configuration.json.

Example — configs

Each object needs id (becomes configuration.<id>), path (Resources path to the pack, no .json suffix), and kind (indexed | object | domains — see LoadConfiguredJsonRoots).

configuration.configs.example.json
{ "configs": [ { "id": "themes", "path": "Data/Themes/index", "kind": "indexed" }, { "id": "filters", "path": "Data/Filters/index", "kind": "object" } ] }

Example — shipPersistentPaths

configuration.shipPersistentPaths.example.json
{ "shipPersistentPaths": [ "Persistent.settings.version", "Persistent.settings.logLevel" ] }

Events

None.

Functions (InvokeFunction)

FunctionParametersBehavior
GetOverridesReturns Persistent.overrides node
GetLastOverridesReturns Persistent.lastOverrides node
SetOverridesoverrides object (or object patch)Merges into pending overrides
SetOverridekey, valueSets one top-level override key
ClearOverridesClears pending overrides
ClearLastOverridesClears last-applied overrides
SetCurrentSlotIdslotIdUpdates current/previous slot ids
GetCurrentSlotId{ value: string }
GetLastSlotId{ value: string }
IsSlotFilledslotId{ value: bool } if save file exists
MarkSlotFilledslotIdWrites slot marker file

Usage example — GetOverrides (tooling / host)

ConfigurationService.Example1.cs
private GnosisNode ReadPendingOverrides() { if (Context?.Store == null || Context.CallService == null) return default; var empty = GnosisNode.CreateObject(Context.Store); var result = CallService("Configuration", "GetOverrides", empty); return result.Success && result.Data.IsValid ? result.Data : default; }

When to open the source

New JSON pack types, merge order, Resources paths, localization load, and shipPersistentPaths — all live here. Prefer searching for Load, Merge, Resources, persistent.json, and shipPersistentPaths.

Last updated on