logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityMenuAnchorUtils

    Utility class providing anchor and pivot calculations for menu positioning.
    Centralizes alignment-to-anchor mappings used across menu building operations.

    Inheritance
    object
    UnityMenuAnchorUtils
    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 UnityMenuAnchorUtils

    Methods

    GetAnchorBasedPosition(UiAnchorType, Vector2)

    Gets the position offset for anchor-based positioning. Since anchors are already at corners/edges, we just offset by borderMargin.

    Declaration
    public static Vector2 GetAnchorBasedPosition(UiAnchorType alignment, Vector2 borderMargin)
    Parameters
    Type Name Description
    UiAnchorType alignment
    Vector2 borderMargin
    Returns
    Type Description
    Vector2

    GetAnchorPivotForAlignment(UiAnchorType)

    Gets the anchor/pivot position based on the menu alignment type.

    Declaration
    public static Vector2 GetAnchorPivotForAlignment(UiAnchorType alignment)
    Parameters
    Type Name Description
    UiAnchorType alignment
    Returns
    Type Description
    Vector2

    GetHorizontalAnchorForMenuAlignment(UiAnchorType)

    Gets the horizontal anchor value (0, 0.5, or 1) based on the menu alignment.

    Declaration
    public static float GetHorizontalAnchorForMenuAlignment(UiAnchorType alignment)
    Parameters
    Type Name Description
    UiAnchorType alignment
    Returns
    Type Description
    float

    IsMenuYAlignmentBottom(IMenuSettingsDefinition)

    Determines whether the menu alignment is bottom-oriented.

    Declaration
    public static bool IsMenuYAlignmentBottom(IMenuSettingsDefinition menuSettings)
    Parameters
    Type Name Description
    IMenuSettingsDefinition menuSettings
    Returns
    Type Description
    bool
    In this article
    © 2026 Serenity. All Rights Reserved