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.
    Thin Unity adapter over UiAnchorMapper (the single anchor→factor mapping), turning the normalized factors into the Vector2 pivots/offsets the menu builders consume.

    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

    GetHorizontalAnchorForViewAlignment(UiAnchorType)

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

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

    IsViewYAlignmentBottom(IMenuSettingsDefinition)

    Determines whether the view alignment is bottom-oriented.

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