Class UITKWorldLabel
A poolable world-anchored label, drawn by UITKWorldLabelLayer. Supports automatic caching after a timed duration or manual caching via Cache(UITKWorldLabel). Visual effects are driven by a LabelEffect bit-flag field and processed each frame; multiple effects combine (e.g. FadeOut + FloatUp + ScaleDown).
[DisallowMultipleComponent]
[RequireComponent(typeof(WorldLabel))]
public sealed class UITKWorldLabel : MonoBehaviour, IReference
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKWorldLabel
- Implements
- 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
This is the UI Toolkit successor to the TextMeshPro-backed Cached3DLabel. The effect
timeline is carried over unchanged — same flags, same tuning fields, same curves — because
it was never rendering-specific: every effect is arithmetic on a position, a font size or a
colour, and those are exactly the three things WorldLabel carries.
The one thing that had to change is where movement lands. The old label moved its own transform, which is not possible here for a label parented to a character that is itself moving. Offsets are written to WorldOffset instead, so effects compose with the anchor rather than replacing it — a damage number can float up off a target that is running away, which the transform-writing version could not do.
Fields
BounceAmplitude
Amplitude in world-units for Bounce.
public float BounceAmplitude
Field Value
BounceFrequency
Frequency in cycles per second for Bounce.
public float BounceFrequency
Field Value
FloatRandomGravity
Gravity (negative = downward) applied each second to FloatRandom.
public float FloatRandomGravity
Field Value
FloatRandomSpeed
Initial speed multiplier for FloatRandom.
public float FloatRandomSpeed
Field Value
FloatUpSpeed
Speed in world-units per second for FloatUp.
[Header("Effect Parameters")]
public float FloatUpSpeed
Field Value
PulseFrequency
Frequency in cycles per second for Pulse.
public float PulseFrequency
Field Value
PulseMax
Max scale multiplier for Pulse.
public float PulseMax
Field Value
PulseMin
Min scale multiplier for Pulse.
public float PulseMin
Field Value
ShakeIntensity
Maximum offset in world-units per axis for Shake.
public float ShakeIntensity
Field Value
WaveAmplitude
Amplitude in world-units for Wave.
public float WaveAmplitude
Field Value
WaveFrequency
Frequency in cycles per second for Wave.
public float WaveFrequency
Field Value
Properties
IsManuallyCached
True when the owner is responsible for returning this label to the pool.
public bool IsManuallyCached { get; }
Property Value
Remarks
Read by UITKLabelMaker so that the live cap never recycles a label a caller is still holding — a nameplate or target frame would otherwise find its label silently reused as somebody else's damage number.
IsPooled
True while this label is sitting in the pool rather than displayed.
public bool IsPooled { get; }
Property Value
Remarks
The flag exists so caching is idempotent. Without it a label cached twice — the expiry path returning it, and a caller that still holds the reference returning it again — was enqueued twice and subsequently handed to two callers at once.
Label
The underlying label data, for callers that need to read or set text directly.
public WorldLabel Label { get; }
Property Value
Methods
Initialize(string, Vector3, Color, float, float, bool, int)
Initializes the label with the specified display properties, effects, and activates it.
public void Initialize(string text, Vector3 position, Color color, float fontSize, float persistTime, bool manualCache, int effectFlags = 0)
Parameters
textstringText to display.
positionVector3World position for the label.
colorColorText color.
fontSizefloatFont size in world units, scaled by distance at render time.
persistTimefloatDuration in seconds before automatic caching. Ignored if manualCache is true.
manualCacheboolIf true, the label must be cached manually via Cache(UITKWorldLabel).
effectFlagsintBit-flag field of LabelEffect values to apply. 0 for no effects.
SetColor(Color)
Sets the text color and updates the base color anchor for fade effects.
public void SetColor(Color color)
Parameters
colorColorThe new color.
SetFontSize(float)
Sets the font size and updates the base font size anchor for scale effects.
public void SetFontSize(float fontSize)
Parameters
fontSizefloatThe new font size in world units.
SetPosition(Vector3)
Sets the world position of the label and clears any accumulated effect offset.
public void SetPosition(Vector3 position)
Parameters
positionVector3The new world position.
SetText(string)
Sets the displayed text content.
public void SetText(string text)
Parameters
textstringThe new text to display.