Skip to Content

Setting

Arbitrary Persistent values as key/value (float, int-as-float, bool, string). Setting service reads/writes any full path under Persistent.* (for example settings.windowMode, audio.soundMasterVolume, haptic.hapticsEnabled).

Adapter: UnitySettingAdapter.

State (Persistent — sample keys)

Typical project keys include settings.* (UI/game settings), audio.* (track volumes/mute), and haptic.* (haptic gates).

How it looks in persistent.json

Abbreviated — your game may add or omit keys; Setting functions write to whatever full key path you pass.

persistent.json
{ "Persistent": { "language": "en", "settings": { "version": "1.0.0", "crtScanlinesStrength": 0, "crtVignetteRound": 64, "windowMode": 2, "vsyncEnabled": true, "framerateCap": 0 }, "audio": { "soundMasterVolume": 1, "soundMasterOn": true, "soundMusicVolume": 1, "soundSfxVolume": 1 }, "haptic": { "hapticsEnabled": true } } }

Events

None.

Functions

FunctionParametersResult
GetSettingObject with keys (list of strings)Object with only requested fields
SetBool{ key: string, value: bool }Writes one bool key at the provided full path; returns readback payload
SetSlider{ key: string, value: number }Writes one numeric key at the provided full path; returns readback payload
SetDropdown{ key: string, index: number }Writes one dropdown-index key (with built-in mappings where applicable); returns readback payload
SetString{ key: string, value: string }Writes one string key at the provided full path; returns readback payload

Usage example — GetSetting

SettingService.Example1.cs
private GnosisNode LoadSomeSettings() { if (Context?.Store == null || Context.CallService == null) return default; var parameters = GnosisNode.CreateObject(Context.Store); var keys = GnosisNode.CreateList(Context.Store); keys.Add("settings.windowMode"); keys.Add("settings.vsyncEnabled"); parameters.Set(GnosisSettingService.SETTING_GET_REQUEST_KEYS_FIELD, keys); var result = CallService("Setting", "GetSetting", parameters); return result.Success && result.Data.IsValid ? result.Data : default; }

Usage example — SetSlider

SettingService.Example2.cs
private GnosisFunctionResult ApplyCrtScanlinesStrength(float value) { if (Context?.Store == null || Context.CallService == null) return GnosisFunctionResult.Fail("No context"); var payload = GnosisNode.CreateObject(Context.Store); payload.Set("key", "settings.crtScanlinesStrength"); payload.Set("value", value); return CallService("Setting", "SetSlider", payload); }

Statistics

None.

Last updated on