Class UITKDialogBox
UI Toolkit confirmation dialog. Shows a message with accept/cancel buttons and invokes optional callbacks.
public class UITKDialogBox : UITKCallbackDialog
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKDialogBox
- 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
The open/close callback rules — refuse rather than hijack, exactly one callback per request on every exit path, callbacks cleared before they are invoked — live in UITKCallbackDialog and are shared with the input dialog and the selector.
Methods
ApplyRequest()
Writes the current request's message and button layout 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 callbacks and the message this request was opened with.
protected override void ClearRequest()
OnStarting()
Resolves cached elements and wires button callbacks.
public override void OnStarting()
OnSubmitKey()
Enter accepts when there is something to accept, and dismisses otherwise.
protected override void OnSubmitKey()
Open(string, Action, Action)
Opens the dialog with the specified message and optional accept/cancel callbacks.
The accept button is hidden when onAccept is null. When the accept
button is shown, the cancel button is labelled "Cancel" (and hidden when
onCancel is null); otherwise the cancel button acts as a "Close" button.
public bool Open(string text, Action onAccept = null, Action onCancel = null)
Parameters
textstringMessage to display.
onAcceptActionOptional callback invoked when accepted.
onCancelActionOptional callback invoked when cancelled.
Returns
- bool
False when the dialog was already showing another question and this one was refused. A refused request is answered immediately through
onCancel, so a caller that locked itself while waiting is released either way.
SetText(string)
Replaces the message without reopening the dialog.
public void SetText(string text)
Parameters
textstringThe new message.
Remarks
For content that updates while the box stays on screen — a queue position counting down, say. Going through Open(string, Action, Action) for that would be refused outright, since the box is already showing the caller's own question.