Skip to Content

Invoke Snippets

Copy/paste JSON snippets for onClickInvokes / onValueChangedInvokes fields on Gnosis UI controls.

Use these in static Unity-authored controls or in CreateElement parameters.

Single invoke row shape

{ "service": "Setting", "function": "SetDropdown", "parameters": { "key": "settings.framerateCap", "index": 0 } }

Push View

[ { "service": "GameUI", "function": "PushView", "parameters": { "viewId": "game.panel.inventory", "inTransitionId": "scalefade", "outTransitionId": "scalefade" } } ]

Pop View

[ { "service": "GameUI", "function": "PopView", "parameters": { "inTransitionId": "scalefade", "outTransitionId": "scalefade" } } ]

Pop View Until

Pops the navigation stack until viewId is the current view. If that view was never pushed (not in history), the service clears history and jumps to viewId in one transition. Optional inTransitionId / outTransitionId match PopView.

[ { "service": "GameUI", "function": "PopViewUntil", "parameters": { "viewId": "title", "inTransitionId": "scalefade", "outTransitionId": "scalefade" } } ]

Push Additive

Shows a view additively without replacing the current stack entry the way PushView does.

[ { "service": "GameUI", "function": "PushViewAdditive", "parameters": { "viewId": "game.overlay.toast" } } ]

Push View + Click Sound

[ { "service": "GameUI", "function": "PushView", "parameters": { "viewId": "game.panel.inventory", "inTransitionId": "scalefade" } }, { "service": "Audio", "function": "PlaySound", "parameters": { "id": "ui.click", "volume": 0.9 } } ]

Exit Game

[ { "service": "GameUI", "function": "ExitGame", "parameters": {} } ]

Dynamic value pattern (Toggle / Slider)

Toggle and Slider invocations inject parameters.value at runtime.

[ { "service": "Setting", "function": "SetSlider", "parameters": { "key": "audio.soundMasterVolume", "value": 0.5 } } ]

The initial value is a fallback/default; runtime replaces it with the live control value.

Dynamic index/text pattern (Dropdown)

Dropdown invocations inject:

  • parameters.index (selected option index)
  • parameters.text (selected option label)
[ { "service": "Setting", "function": "SetDropdown", "parameters": { "key": "settings.framerateCap", "index": 0 } } ]

SetDropdown uses parameters.index. parameters.text can still be included for other service calls chained in the same invoke list.

Dynamic bool pattern (Toggle)

[ { "service": "Setting", "function": "SetBool", "parameters": { "key": "settings.vsyncEnabled", "value": true } } ]

Dynamic string pattern

[ { "service": "Setting", "function": "SetString", "parameters": { "key": "language", "value": "en" } } ]

Reusable transition preset snippet

Use this object wherever you need consistent UI transition ids.

{ "inTransitionId": "scalefade", "outTransitionId": "scalefade" }

About additive views

  • Invoke JSON: use GameUI.PushViewAdditive with a viewId (see above).
  • Adapter C# API: UnityGameUIAdapter.PushViewAdditive is the Unity-side entry when calling from code outside invocations.
Last updated on