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": "..." }
- a
selectedIndex(float/int) — 0-based index applied afteroptionsare rebuilt (SetValueWithoutNotify, so it does not fireonValueChangedduring 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 indextext(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