UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Ui Module / Dropdown Extension Completed

Ui Module — UGTK

DropDown Extension

Summary

The DropDown Extension wraps a TMP_Dropdown so it speaks strings instead of indices: it re-emits the selected option's text on change, selects an option by its label, and repopulates the whole list from a List<string>. It removes the index bookkeeping that makes dropdowns annoying as soon as the options come from data instead of being fixed in the inspector.


Content


Modules Dependencies

None on the UGTK side. It requires Unity's TextMeshPro package (TMP_Dropdown).


Setup

Drop the Dropdown prefab under a Canvas — a TMP dropdown with Mn_UGTKDropDown_Extension already attached:

Or add the component to a GameObject that already has a TMP_Dropdown — it finds the dropdown on itself in Awake.


How To Use

// selection -> string, wired from the inspector or from code
dropdownExt.onValueChanged.AddListener(label => Debug.Log($"Chosen: {label}"));

dropdownExt.SetChoice("Italiano");                       // select by label (fires onValueChanged)
dropdownExt.FillOptions(new List<string>{ "EN","IT" });  // rebuild the whole list

Good to know:


Testing Scene

Open Debug/DropdownScene.unity and press Play: pick an option and the component re-emits its label.


Technical Info

Path Content
Scripts/Mn_UGTKDropDown_Extension.cs The component: caches the TMP_Dropdown, listens to its onValueChanged, re-emits the option text, SetChoice and FillOptions
Scripts/Editor/Mn_UGTKDropDown_ExtensionEditor.cs Custom inspector
Prefabs/Dropdown.prefab TMP dropdown with the component attached
Debug/DropdownScene.unity Test scene

API: onValueChanged (UnityEvent<string>), SetChoice(string), FillOptions(IList<string>).


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 0

  • Standalone: no other module required.

Used by 2

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 0 modules in total.