Class UITKSelector
UI Toolkit selector. Presents a list of selectable cached objects, lets the user pick one, and confirms or cancels the selection. Each option row is a plain UnityEngine.UIElements.Button, so no separate tooltip-button class is required.
public class UITKSelector : UITKCallbackDialog
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKSelector
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Follows the shared open/close callback rules in UITKCallbackDialog: it is a
singleton panel, so a second Open is refused rather than allowed to replace a list
the player is already choosing from, and every exit path — accept, cancel, Escape,
quit-to-login, a refused open — produces exactly one callback.
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
ApplyRequest()
Rebuilds the option rows into the live tree.
protected override void ApplyRequest()
CancelRequest()
Answers the request down its cancel path. Escape, quit-to-login and a bare Hide() all arrive here.
protected override void CancelRequest()
ClearRequest()
Drops the rows, the objects and the callbacks this request was opened with.
protected override void ClearRequest()
FocusDefault()
Focuses the panel root so the arrow keys and Enter have somewhere to arrive.
protected override void FocusDefault()
Remarks
Not the first row: the rows are Buttons, and a focused button is activated by
the space bar, so the first option would silently select itself under a player who
was mid-jump. The first arrow key highlights a row explicitly.
OnClick_Accept()
Invokes the accept callback with the selected object's ID and closes the selector.
public void OnClick_Accept()
Remarks
With nothing selected there is no answer to give, so the selector stays open rather than closing on a non-answer.
OnClick_Cancel()
Closes the selector without making a selection.
public void OnClick_Cancel()
OnDestroying()
Answers any outstanding request and clears button slots when the control is destroyed.
public override void OnDestroying()
OnNavigateKey(int)
Arrow keys move the highlight through the option rows.
protected override bool OnNavigateKey(int direction)
Parameters
directionint-1 for up, 1 for down.
Returns
- bool
True when a row was highlighted.
OnStarting()
Resolves cached elements and wires the accept/cancel buttons.
public override void OnStarting()
OnSubmitKey()
Enter accepts the highlighted option.
protected override void OnSubmitKey()
Open(List<ICachedObject>, Action<int>, Action)
Opens the selector with the provided cached objects and callbacks.
public bool Open(List<ICachedObject> cachedObjects, Action<int> onAccept, Action onCancel = null)
Parameters
cachedObjectsList<ICachedObject>List of objects to select from.
onAcceptAction<int>Callback invoked with the selected object's ID when accepted.
onCancelActionCallback invoked when the player dismisses without choosing.
Returns
- bool
False when the request could not be honoured — nothing to choose from, or a selection already on screen. Either way
onCancelis invoked immediately, so the caller is never left waiting on a selector that was never shown.