logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityMenuOptionEditorState

    Editor-only presentation helpers for the UI-option inspectors. The actual validity rules (allowed interaction types, option/binding validation, GameSettings type matching) live in the engine-agnostic UiOptionRules (Business/Menu/Application); this class only builds the popup option list widget used to render them.

    Inheritance
    object
    UnityMenuOptionEditorState
    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.Settings.Editor
    Assembly: Serenity.UnityMenu.Infrastructure.Editor.dll
    Syntax
    public static class UnityMenuOptionEditorState

    Methods

    BuildPopupOptions(IReadOnlyList<string>, IReadOnlyList<string>, string, out int, out bool)

    Builds the popup's display list for a caller whose entries show one string and store another: values is matched against currentValue, and the popup shows displayLabels. An "<Invalid: X>" entry is inserted (selected) at index 0 when the current value matches nothing, exactly as the label == value overload does.

    Declaration
    public static List<string> BuildPopupOptions(IReadOnlyList<string> values, IReadOnlyList<string> displayLabels, string currentValue, out int selectedIndex, out bool hasInvalidSelection)
    Parameters
    Type Name Description
    IReadOnlyList<string> values

    What each entry stores, index-aligned with displayLabels.

    IReadOnlyList<string> displayLabels

    What each entry shows.

    string currentValue

    The option's serialized value.

    int selectedIndex

    Index of the entry to show as selected.

    bool hasInvalidSelection

    Whether an "<Invalid: X>" entry was prepended.

    Returns
    Type Description
    List<string>

    The labels to hand the popup.

    Remarks

    Deliberately filters nothing: the caller indexes its own key list by the popup's answer, so a Where or Distinct here would shift every index past the first dropped entry and write the wrong key. Keeping the lists aligned is the caller's contract.

    BuildPopupOptions(IReadOnlyList<string>, string, out int, out bool)

    Builds the popup's display option list from the valid options, inserting an "<Invalid: X>" entry (selected) when the current value doesn't match any of them. Empty and duplicate entries are dropped first, which is safe only because each entry shows what it stores — a caller that keeps a separate key list aligned with these entries must use the label-aware overload instead.

    Declaration
    public static List<string> BuildPopupOptions(IReadOnlyList<string> validOptions, string currentValue, out int selectedIndex, out bool hasInvalidSelection)
    Parameters
    Type Name Description
    IReadOnlyList<string> validOptions
    string currentValue
    int selectedIndex
    bool hasInvalidSelection
    Returns
    Type Description
    List<string>

    GetAllowedInteractionTypes(UiComponentValueType)

    Declaration
    public static IReadOnlyList<UiComponentInteractionType> GetAllowedInteractionTypes(UiComponentValueType valueType)
    Parameters
    Type Name Description
    UiComponentValueType valueType
    Returns
    Type Description
    IReadOnlyList<UiComponentInteractionType>

    IsInteractionTypeAllowed(UiComponentValueType, UiComponentInteractionType)

    Declaration
    public static bool IsInteractionTypeAllowed(UiComponentValueType valueType, UiComponentInteractionType interactionType)
    Parameters
    Type Name Description
    UiComponentValueType valueType
    UiComponentInteractionType interactionType
    Returns
    Type Description
    bool

    ValidateOption(UiOption, string, IReadOnlyDictionary<string, GameSettingsValueType>, IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>, IReadOnlyCollection<string>)

    Declaration
    public static List<string> ValidateOption(UiOption option, string menuId, IReadOnlyDictionary<string, GameSettingsValueType> gameSettingsById, IReadOnlyDictionary<string, string> gameSettingIdsByGuid, IReadOnlyDictionary<string, string> actionIdsByGuid, IReadOnlyCollection<string> menuIds)
    Parameters
    Type Name Description
    UiOption option
    string menuId
    IReadOnlyDictionary<string, GameSettingsValueType> gameSettingsById
    IReadOnlyDictionary<string, string> gameSettingIdsByGuid
    IReadOnlyDictionary<string, string> actionIdsByGuid
    IReadOnlyCollection<string> menuIds
    Returns
    Type Description
    List<string>
    In this article
    © 2026 Serenity. All Rights Reserved