Class UITKPetControl
UI Toolkit pet control panel. Shows each pet's name and health, one row per pet, and issues follow/stay/summon/release commands, which go to every pet.
public class UITKPetControl : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKPetControl
- 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.MemberwiseClone()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
Clicking a pet's row pins that pet to the target frame (TryPinTarget(Transform)), and the pinned pet's row is marked.
A pet's health is a live value, so this panel subscribes to each pet's health attribute rather than sampling it once at summon time. It previously read the attribute exactly twice — on summon and on character set — and then never again, so the bar showed the pet's health at the moment it appeared for the pet's whole life.
The fill fraction was also inverted (FinalValue / CurrentValue), which reads as a
full bar at any health at all and an over-full one below half, and the name block set the
GUILD label active inside a check on the NAME label.
Fields
ROW_PREFIX
Name prefix of a pet's row; the pet's slot follows.
public const string ROW_PREFIX = "pet-row-"
Field Value
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
OnAfterShow()
Called at the end of Show(), against the tree the player will actually see. Override to write content that changes from one opening to the next.
protected override void OnAfterShow()
Remarks
Panels keep their tree across hide and show, so an element written while hidden still holds that value when shown. This is the place for content that should be current at the moment of opening, and for resetting anything a fresh opening should not inherit from the last one: typed text, a pending confirmation, a leftover error.
Distinct from OnAfterStarting(), which runs once when the panel starts and again only if its tree is ever genuinely rebuilt. This one runs on every show.
OnAfterStarting()
Re-applies the character once the visual tree exists.
protected override void OnAfterStarting()
Remarks
World entry calls SetCharacter(IPlayerCharacter) for every control at once, and
a control's visual tree can come up after its Awake (and, when hiding disabled the
document, a hidden control had none until something showed it) — so
OnPostSetCharacter() can run before OnStarting has cached any
elements. Overrides that write into those elements would then dereference null, and
even a null-safe one would leave the panel showing nothing, because the only call
that had data already happened. Running it again here is what makes the two orders
equivalent.
OnAttackWithPet()
Orders every pet to attack the player's current target.
public void OnAttackWithPet()
Remarks
Names the target frame — the pinned target when one is held, else whatever is hovered — so the pet goes at what the player is looking at in the HUD rather than at whatever the camera centre happens to trace. The server verifies the claim before acting on it; see PetAttackBroadcast.
OnDestroying()
Releases the static pet subscriptions and the pet health subscription.
public override void OnDestroying()
OnFollowPet()
Sends a follow command to every pet.
public void OnFollowPet()
OnPetRowClicked(Pet)
Clicking a pet's row pins that pet as the target.
public void OnPetRowClicked(Pet pet)
Parameters
petPet
OnPostSetCharacter()
Binds the panel to whatever pet the character already has.
public override void OnPostSetCharacter()
OnPreSetCharacter()
Releases the outgoing character's pet binding before a new character is applied.
public override void OnPreSetCharacter()
OnPreUnsetCharacter()
Releases the pet binding and resets the panel.
public override void OnPreUnsetCharacter()
OnPriorityMoveDown(int)
Moves the step in slot one place later; see OnPriorityMoveUp(int).
public void OnPriorityMoveDown(int slot)
Parameters
slotint
OnPriorityMoveUp(int)
Moves the step in slot one place earlier, remembers the new order
and asks the server to adopt it.
public void OnPriorityMoveUp(int slot)
Parameters
slotint
Remarks
Applied locally at once so the rows respond to the click; the server's confirmation then arrives through PetController_OnPetOrdersChanged(Pet) and, being the order in force, overwrites whatever is shown. The local copy is stored regardless of whether a pet is out, because the preference is the player's and the pet is only its current audience — it is replayed on the next summon.
OnReleasePet()
Releases every pet.
public void OnReleasePet()
OnStanceAggressive()
Requests the aggressive stance.
public void OnStanceAggressive()
OnStanceDefensive()
Requests the defensive stance.
public void OnStanceDefensive()
OnStancePassive()
Requests the passive stance.
public void OnStancePassive()
OnStarting()
Queries elements and wires up the command buttons.
public override void OnStarting()
OnStayPet()
Sends a stay command to every pet.
public void OnStayPet()
OnSummonPet()
Calls every pet to the player's side.
public void OnSummonPet()
OnTick()
Each frame while shown: every row against the pet itself, the way the target frame reads its pinned target.
protected override void OnTick()
Remarks
The rows follow health events, and the events are right; but a row bound to an object that is no longer the pet hears nothing, and the panel sat at full health while the target frame, reading the live pet, showed 65% (2026-11-18). So a row whose pet is no longer the listed, live object is rebound, and a row whose drawn numbers differ from its health is redrawn: two integer comparisons per pet per frame until something moves.
OnTogglePriorityPanel()
Shows or hides the attack priority rows.
public void OnTogglePriorityPanel()
PetController_OnClientPetAction(Pet, PetAction, long)
What the pet has just started doing, from the server (PetActionBroadcast): which target an attack order chose, or a fight it joined on its own.
public void PetController_OnClientPetAction(Pet pet, PetAction action, long targetID)
Parameters
PetController_OnPetDestroyed(Pet)
Drops a pet's row when it leaves; hides the panel when none is left.
public void PetController_OnPetDestroyed(Pet pet)
Parameters
petPetThe pet that left, or null when every pet left.
PetController_OnPetOrdersChanged(Pet)
Refreshes the panel when the server confirms a stance or movement order change.
public void PetController_OnPetOrdersChanged(Pet pet)
Parameters
petPetThe first of the pets whose orders changed.
PetController_OnPetSummoned(Pet)
Adds a summoned pet's row and makes the panel visible.
public void PetController_OnPetSummoned(Pet pet)
Parameters
petPetThe summoned pet.