Table of Contents

Class WorldLabel

Namespace
FishMMO.Shared.Core
Assembly
FishMMO.Shared.dll

A piece of text anchored to a position in the world, rendered by whatever UI layer is present rather than by a renderer of its own.

[DisallowMultipleComponent]
public sealed class WorldLabel : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
WorldLabel
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.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.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.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.name
Object.hideFlags

Remarks

This replaces the TextMeshPro components that used to hang off characters. UI Toolkit has no world-space rendering, so a label can no longer be a renderer sitting in the scene — it is a position plus some text, and the client projects it onto a screen-space panel every frame (see UITKWorldLabelLayer).

The property names are deliberately text, color and fontSize rather than the PascalCase this codebase otherwise uses. Roughly thirty call sites across Shared and Client assign through them, and matching the old TextMeshPro surface exactly is what lets those sites carry over untouched instead of being rewritten for a change that does not concern them.

Being a MonoBehaviour also keeps label.gameObject.SetActive(false) working as the visibility switch it always was: a disabled label deregisters, and the renderer never sees it. The server never instantiates these — nothing outside a client scene creates one — so the type is inert in headless builds.

Properties

Active

Read-only view of the currently enabled labels, for the renderer to walk.

public static IReadOnlyList<WorldLabel> Active { get; }

Property Value

IReadOnlyList<WorldLabel>

Revision

Incremented whenever text, colour or font size changes.

public int Revision { get; }

Property Value

int

Remarks

The renderer pushes text and colour onto its backing element only when this moves, rather than every frame for every label. Position still updates every frame because the camera moves regardless of whether the label changed.

SortOrder

Optional sort bias. Higher values draw in front of lower ones within the label layer.

public int SortOrder { get; set; }

Property Value

int

WorldOffset

World-space offset applied to this transform's position before projection.

public Vector3 WorldOffset { get; set; }

Property Value

Vector3

WorldPosition

The world position this label should be drawn at.

public Vector3 WorldPosition { get; }

Property Value

Vector3

color

The text colour.

public Color color { get; set; }

Property Value

Color

fontSize

Font size in panel points.

public float fontSize { get; set; }

Property Value

float

text

The displayed text. Rich-text markup is permitted.

public string text { get; set; }

Property Value

string

Methods

Set(string, Color)

Sets text and colour together without raising two revisions.

public void Set(string value, Color tint)

Parameters

value string

The text to display.

tint Color

The colour to display it in.

Events

OnLabelDisabled

Raised when a label is disabled or destroyed, so a renderer can release its backing UI.

public static event Action<WorldLabel> OnLabelDisabled

Event Type

Action<WorldLabel>

OnLabelEnabled

Raised when a label is enabled, so a renderer can create backing UI for it.

public static event Action<WorldLabel> OnLabelEnabled

Event Type

Action<WorldLabel>