logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityMenuMeasurementUtils

    Utility class providing measurement helpers for menu UI elements.
    Handles prefab dimension lookups, text rendering width calculations, and content bounds measurement.

    Inheritance
    object
    UnityMenuMeasurementUtils
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Menu.Infrastructure.Views.Factories
    Assembly: Serenity.UnityMenu.Infrastructure.dll
    Syntax
    public static class UnityMenuMeasurementUtils

    Methods

    GetOptionLabelTextWidth(GameObject)

    Gets the rendered width of an option's label text.

    Declaration
    public static float GetOptionLabelTextWidth(GameObject optionGameObject)
    Parameters
    Type Name Description
    GameObject optionGameObject
    Returns
    Type Description
    float

    GetOptionTotalContentWidth(GameObject, IUiThemeDefinition)

    Gets the total content width of an option, measuring bounding box of children for non-SUBMIT/STRING types, or label text width for SUBMIT/STRING.

    Declaration
    public static float GetOptionTotalContentWidth(GameObject optionGameObject, IUiThemeDefinition theme)
    Parameters
    Type Name Description
    GameObject optionGameObject
    IUiThemeDefinition theme
    Returns
    Type Description
    float

    GetPrefabForInteractionType(UiComponentInteractionType, IUiThemeDefinition)

    Gets the prefab template GameObject for a given interaction type from the theme.

    Declaration
    public static GameObject GetPrefabForInteractionType(UiComponentInteractionType interactionType, IUiThemeDefinition theme)
    Parameters
    Type Name Description
    UiComponentInteractionType interactionType
    IUiThemeDefinition theme
    Returns
    Type Description
    GameObject

    GetPrefabHeightForInteractionType(UiComponentInteractionType, IUiThemeDefinition)

    Gets the height of the prefab template for a given interaction type from the theme.

    Declaration
    public static float GetPrefabHeightForInteractionType(UiComponentInteractionType interactionType, IUiThemeDefinition theme)
    Parameters
    Type Name Description
    UiComponentInteractionType interactionType
    IUiThemeDefinition theme
    Returns
    Type Description
    float

    GetPrefabWidthForInteractionType(UiComponentInteractionType, IUiThemeDefinition)

    Gets the width of the prefab template for a given interaction type from the theme.

    Declaration
    public static float GetPrefabWidthForInteractionType(UiComponentInteractionType interactionType, IUiThemeDefinition theme)
    Parameters
    Type Name Description
    UiComponentInteractionType interactionType
    IUiThemeDefinition theme
    Returns
    Type Description
    float

    GetTextRenderedWidth(TMP_Text)

    Gets the rendered width of text content from a TMP_Text component. Forces mesh update to ensure accurate bounds calculation.

    Declaration
    public static float GetTextRenderedWidth(TMP_Text text)
    Parameters
    Type Name Description
    TMP_Text text
    Returns
    Type Description
    float

    GetTitlePrefabHeight(IUiThemeDefinition)

    Gets the height of the title prefab template from the theme.

    Declaration
    public static float GetTitlePrefabHeight(IUiThemeDefinition theme)
    Parameters
    Type Name Description
    IUiThemeDefinition theme
    Returns
    Type Description
    float

    GetTitlePrefabWidth(IUiThemeDefinition)

    Gets the width of the title prefab template from the theme.

    Declaration
    public static float GetTitlePrefabWidth(IUiThemeDefinition theme)
    Parameters
    Type Name Description
    IUiThemeDefinition theme
    Returns
    Type Description
    float

    GetTitleTextWidth(GameObject)

    Gets the rendered width of a title GameObject's text content.

    Declaration
    public static float GetTitleTextWidth(GameObject titleGameObject)
    Parameters
    Type Name Description
    GameObject titleGameObject
    Returns
    Type Description
    float
    In this article
    © 2026 Serenity. All Rights Reserved