Utility class providing measurement helpers for menu UI elements.
Handles prefab dimension lookups, text rendering width calculations, and content bounds measurement.
Inheritance
UnityMenuMeasurementUtils
Assembly: Serenity.UnityMenu.Infrastructure.dll
public static class UnityMenuMeasurementUtils
Methods
Gets the rendered width of an option's label text.
Declaration
public static float GetOptionLabelTextWidth(GameObject optionGameObject)
Parameters
| Type |
Name |
Description |
| GameObject |
optionGameObject |
|
Returns
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
Returns
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
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
Returns
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
Returns
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
GetTitlePrefabHeight(IUiThemeDefinition)
Gets the height of the title prefab template from the theme.
Declaration
public static float GetTitlePrefabHeight(IUiThemeDefinition theme)
Parameters
Returns
GetTitlePrefabWidth(IUiThemeDefinition)
Gets the width of the title prefab template from the theme.
Declaration
public static float GetTitlePrefabWidth(IUiThemeDefinition theme)
Parameters
Returns
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