Class UITKAdvancedLabel
A transient caption drawn at a screen position, with optional fade and upward drift. Used for region names and similar one-off announcements.
[DisallowMultipleComponent]
public sealed class UITKAdvancedLabel : MonoBehaviour, IReference
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKAdvancedLabel
- 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
Replaces the IMGUI-based UIAdvancedLabel, which drew through GUI.Label in an
OnGUI pass — a separate immediate-mode render path that measured its own text with
GUIStyle.CalcSize and positioned everything by hand against Screen.width.
The public surface is deliberately identical: Create(string, FontStyle, Font, int, Color, float, bool, bool, Vector2), Initialize(string, FontStyle, Font, int, Color, float, bool, bool, Vector2),
SetText(string), SetColor(Color), ChangeFont(int) and
SetPosition(Vector3) keep their old signatures, including the legacy FontStyle
and Font parameters. DisplayRegionNameAction in FishMMO-Shared raises its
event with those types and the server compiles that file too, so leaving the signature
alone keeps a rendering change out of the shared assembly.
The element lives in ScreenContainer rather than in a
document of its own, because these are created at runtime with a bare
new GameObject and have nowhere to hang a UIDocument.
Fields
FadeColor
If true, the label colour fades in then out over its lifetime.
public bool FadeColor
Field Value
FadeTime
Total fade time for the label in seconds.
public float FadeTime
Field Value
IncreaseY
If true, the label drifts upward over its lifetime.
public bool IncreaseY
Field Value
OldY
The starting Y offset for upward movement.
public float OldY
Field Value
PixelOffset
Pixel offset from the centre of the screen.
public Vector2 PixelOffset
Field Value
- Vector2
RemainingLife
Remaining lifetime of the label in seconds.
public float RemainingLife
Field Value
TargetColor
Colour the label fades towards.
public Color TargetColor
Field Value
- Color
Text
The text displayed by the label.
public string Text
Field Value
YIncreaseValue
The target Y offset for upward movement.
public float YIncreaseValue
Field Value
Methods
ChangeFont(int)
Changes the font size of the label.
public void ChangeFont(int fontSize)
Parameters
fontSizeintNew font size.
Create(string, FontStyle, Font, int, Color, float, bool, bool, Vector2)
Creates a new label instance and initializes it with the provided parameters.
public static IReference Create(string text, FontStyle style, Font font, int fontSize, Color color, float lifeTime, bool fadeColor, bool increaseY, Vector2 pixelOffset)
Parameters
textstringText to display.
styleFontStyleFont style.
fontFontFont to use. Ignored — the panel's theme supplies the face.
fontSizeintFont size.
colorColorText color.
lifeTimefloatLifetime of the label in seconds.
fadeColorboolIf true, label fades color over time.
increaseYboolIf true, label moves upward over time.
pixelOffsetVector2Pixel offset for label placement.
Returns
- IReference
Reference to the created label.
Initialize(string, FontStyle, Font, int, Color, float, bool, bool, Vector2)
Initializes the label with the provided parameters.
public void Initialize(string text, FontStyle fontStyle, Font font, int fontSize, Color color, float lifeTime, bool fadeColor, bool increaseY, Vector2 pixelOffset)
Parameters
textstringText to display.
fontStyleFontStyleFont style.
fontFontFont to use. Ignored — the panel's theme supplies the face.
fontSizeintFont size.
colorColorText color.
lifeTimefloatLifetime of the label in seconds.
fadeColorboolIf true, label fades color over time.
increaseYboolIf true, label moves upward over time.
pixelOffsetVector2Pixel offset for label placement.
SetColor(Color)
Sets the label's color.
public void SetColor(Color color)
Parameters
colorColorNew color to set.
SetPosition(Vector3)
Sets the world position of the label's transform.
public void SetPosition(Vector3 position)
Parameters
positionVector3World position to set.
SetText(string)
Sets the label's text.
public void SetText(string text)
Parameters
textstringNew text to display.