logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class HudPreviewBuilder

    Populates a preview canvas with a HUD's elements, drawn from the theme and fed sample values.

    Inheritance
    object
    HudPreviewBuilder
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.GameUi.Infrastructure.Editor.Builder
    Assembly: Serenity.UnityGameUi.Infrastructure.Editor.dll
    Syntax
    public static class HudPreviewBuilder
    Remarks

    Delegates to the runtime element view rather than re-drawing anything, so the preview cannot drift from what the game renders. The elements it creates are throwaway: the preview rig clears its canvas on every render.

    Methods

    Build(UnityHudDefinition, RectTransform, IUiThemeDefinition, int)

    Builds every element of hud under canvasRoot.

    Declaration
    public static IReadOnlyList<PreviewElementHandle> Build(UnityHudDefinition hud, RectTransform canvasRoot, IUiThemeDefinition theme, int onlyElementIndex = -1)
    Parameters
    Type Name Description
    UnityHudDefinition hud

    The HUD being previewed.

    RectTransform canvasRoot

    The preview rig's canvas root.

    IUiThemeDefinition theme

    The theme to draw with; null falls back to unthemed text.

    int onlyElementIndex

    When zero or greater, builds just that one element — plus its ancestor chain, so a parented element still lands where its box would put it, and its descendants, so isolating a box still shows what it holds — rather than every element in the HUD.

    Returns
    Type Description
    IReadOnlyList<PreviewElementHandle>

    A handle for every element actually built, so the caller can hit-test and highlight them.

    In this article
    © 2026 Serenity. All Rights Reserved