logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class HudTextRepresentationRenderer

    Renders any textual representation into a single text object, writing only when the formatted result actually changed.

    Inheritance
    object
    HudTextRepresentationRenderer
    Implements
    IHudRepresentationRenderer
    IHudValueColorable
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.GameUi.Infrastructure.Representations
    Assembly: Serenity.UnityGameUi.Infrastructure.dll
    Syntax
    public sealed class HudTextRepresentationRenderer : IHudRepresentationRenderer, IHudValueColorable
    Remarks

    The change check is what makes a per-frame HUD affordable: assigning TMP_Text.text dirties the mesh and forces a re-layout even when the string is identical, and most HUD values hold still for many frames at a time.

    Constructors

    HudTextRepresentationRenderer(UnityHudTextualRepresentation)

    Creates a renderer for one textual representation.

    Declaration
    public HudTextRepresentationRenderer(UnityHudTextualRepresentation representation)
    Parameters
    Type Name Description
    UnityHudTextualRepresentation representation

    The representation whose formatting to use.

    Methods

    Apply(CompiledHudBinding, CompiledHudBinding)

    Updates the visuals from the current binding values.

    Declaration
    public void Apply(CompiledHudBinding value, CompiledHudBinding capacity)
    Parameters
    Type Name Description
    CompiledHudBinding value

    The element's value binding.

    CompiledHudBinding capacity

    The element's capacity binding, or null when it has none.

    ApplyValueColor(Color)

    Colours the representation's value for as long as it stays in its current threshold band.

    Declaration
    public void ApplyValueColor(Color color)
    Parameters
    Type Name Description
    Color color

    The band's authored colour.

    Remarks

    Touches only this renderer's own value text, never a caption — the caption is a separate text object UnityHudElementView creates and styles on its own, and this renderer never holds a reference to it.

    Build(RectTransform, HudRenderResources)

    Builds the visuals under the element's container.

    Declaration
    public void Build(RectTransform container, HudRenderResources resources)
    Parameters
    Type Name Description
    RectTransform container

    The element's anchored container.

    HudRenderResources resources

    Theme-derived building blocks.

    Remarks

    The resources carry the theme's HUD style, so chrome is resolved here rather than baked when the renderer is created: a representation does not know which theme it will be drawn under.

    ClearValueColor()

    Restores whatever colour the representation had before any threshold band applied.

    Declaration
    public void ClearValueColor()

    Implements

    IHudRepresentationRenderer
    IHudValueColorable
    In this article
    © 2026 Serenity. All Rights Reserved