Skip to Content

Dropdown

GnosisUIElementDropdown is a control element (elementId = "Dropdown") backed by TMP_Dropdown.

Attach TMP_Dropdown on the same GameObject (or assign in the inspector). In the editor, if the component is missing, it is auto-added on validate.

Runtime parameters

In addition to built-in element parameters, GnosisUIElementDropdown supports:

  • options (list) — option labels. Each entry may be:
    • a string, or
    • an object { "text": "..." }
  • selectedIndex (float / int) — 0-based index applied after options are rebuilt (SetValueWithoutNotify, so it does not fire onValueChanged during apply).
  • onValueChangedInvokes (list) — service invokes when the user changes the selection. Each row: { service, function, parameters? }.

Each invoke receives an object payload with:

  • index (int) — selected index
  • text (string) — selected option label

Example — JSON payload shape

{ "service": "GameUI", "function": "CreateElement", "parameters": { "elementId": "Dropdown", "parentId": "ui.SettingsView", "parameters": { "name": "WindowModeDropdown", "options": [ { "text": "Windowed" }, { "text": "Fullscreen" }, { "text": "Borderless" } ], "selectedIndex": 0.0, "onValueChangedInvokes": [ { "service": "Setting", "function": "SetDropdown", "parameters": { "key": "settings.windowMode", "index": 0 } } ] } } }

Example — DescribeUIElement

payload.Set("elementId", "Dropdown"); return CallService("GameUI", "DescribeUIElement", payload);
Last updated on