Class UITKDeathDialog
Death dialog shown when the local player dies. Offers two options: "Respawn at Bind Point" (always visible) and "Accept Resurrect" (appears when another player casts resurrect on the corpse). Sends the appropriate broadcast on button click and hides on success.
There is deliberately no close button. Respawning or being resurrected are the only
ways out of the dead state, and both are reached through this dialog — a control that
merely dismissed it would leave the player a corpse with no route back, because the
server only re-sends DeathBroadcast on scene entry.
Two properties keep a character from getting stuck dead:
- It opens from state, not just from a message. A character that
arrives already dead — a login while dead, or a scene transfer while dead — surfaces the
dialog from OnPostSetCharacter(), which reads the replicated
IsDead flag out of the spawn payload. That does not depend
on a
DeathBroadcastarriving at the right moment relative to the world GUI scene finishing its load. - It confirms rather than assumes. Clicking an action used to hide the dialog immediately, so a request the server declined — its respawn/resurrect ingress guard debounces at two seconds — left the player dead with no UI and no way to ask again. The dialog now stays up until the character is actually observed alive, and re-arms itself if that never happens.
public class UITKDeathDialog : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKDeathDialog
- 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
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
OnClientSet()
Registers for resurrect offers for as long as a client is attached.
public override void OnClientSet()
Remarks
Registration is tied to the client, not to the dialog being visible. Doing it in
Show() registered the same handler again on every call — and the server
re-sends DeathBroadcast whenever a dead character loads into a scene, so a
player who died and then changed scenes accumulated duplicate handlers, each firing
on the same offer. It also meant an offer that arrived while the dialog was hidden
was dropped entirely.
OnClientUnset()
Unregisters the resurrect-offer handler when the client is cleared.
public override void OnClientUnset()
OnPostSetCharacter()
Opens the dialog when the character this control was just handed is already dead.
public override void OnPostSetCharacter()
Remarks
This is the login-while-dead and transfer-while-dead path. Flags travels in
the spawn payload, so by the time the local character is injected here the client
already knows it is dead — no broadcast required. The server does also re-send
DeathBroadcast on scene entry, and the two converge on the same idempotent
call; this one is the reliable half, because it cannot be missed by a message
arriving before the world GUI scene carrying this dialog has finished loading.
OnPreUnsetCharacter()
Drops any in-flight request when the character goes away, so a new session cannot inherit a pending confirmation.
public override void OnPreUnsetCharacter()
OnQuitToLogin()
Clears any pending resurrect offer when the player returns to the login screen, so a later session cannot inherit a stale resurrector ID.
public override void OnQuitToLogin()
OnStarting()
Queries UXML elements and wires button click handlers.
public override void OnStarting()
OnTick()
Watches for a requested respawn or resurrect actually taking effect.
protected override void OnTick()
Remarks
Runs regardless of whether the panel is showing: Hide()
disables the UIDocument, not this component, so the confirmation is still
driven while the dialog is hidden.
Health is the signal rather than IsDead, because the flag is only sent in the spawn payload and is never re-synced; the health resource is replicated continuously, and the server's revive path restores it.
Show()
Shows the dialog, binding its elements on first use.
public override void Show()
ShowDeathDialog()
Called when the local player dies. Shows "You have died." and the Respawn button.
public void ShowDeathDialog()