logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementConditionTypeMenu

    The catalogue of condition node types an author can pick from, and the searchable dropdown that offers them grouped by category.

    Inheritance
    object
    AchievementConditionTypeMenu
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Infrastructure.Editor
    Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
    Syntax
    public static class AchievementConditionTypeMenu
    Remarks

    Built by scanning every non-abstract, publicly-constructible AchievementCondition UnityEditor.TypeCache knows about, minus anything declared in a test assembly — the framework's own conditions and any a project authors, each shelved under the category it declares with AchievementConditionCategoryAttribute. A node type that exists but cannot be picked is a node type an author will never author, and a project no longer has to edit this table to make its own rule pickable.

    Each entry's label is read from a freshly created instance's DisplayName rather than restated here, so the name in the menu and the name in the node's own header cannot drift apart.

    Fields

    MenuTitle

    The title shown at the root of the dropdown.

    Declaration
    public const string MenuTitle = "Condition"
    Field Value
    Type Description
    string

    UnnamedCategoryHeading

    Where node types whose category nobody named end up in the picker.

    Declaration
    public const string UnnamedCategoryHeading = "Unknown category"
    Field Value
    Type Description
    string

    Properties

    Entries

    Declaration
    public static IReadOnlyList<AchievementConditionTypeEntry> Entries { get; }
    Property Value
    Type Description
    IReadOnlyList<AchievementConditionTypeEntry>

    Every node type an author can pick, in menu order.

    Methods

    Build(IEnumerable<Type>)

    Builds a catalogue from the given candidate types: the framework's own condition types first, in Serenity.Achievements.Infrastructure.Editor.AchievementConditionTypeMenu.CatalogueOrder, then any other concrete AchievementCondition among the candidates — framework or project-authored — that Serenity.Achievements.Infrastructure.Editor.AchievementConditionTypeMenu.CatalogueOrder does not already name, appended alphabetically under its declared category.

    Declaration
    public static AchievementConditionTypeEntry[] Build(IEnumerable<Type> candidateTypes)
    Parameters
    Type Name Description
    IEnumerable<Type> candidateTypes

    The types to consider. Only concrete, publicly-constructible AchievementCondition types among them are kept.

    Returns
    Type Description
    AchievementConditionTypeEntry[]

    The built catalogue, in menu order.

    Remarks

    This is the seam a test builds a catalogue through: it hands Build(IEnumerable<Type>) exactly the types a scenario needs instead of depending on whatever UnityEditor.TypeCache happens to know about in the editor session running the test — which, in an EditMode run, includes the test assemblies themselves.

    CategoryLabel(AchievementConditionCategory)

    The heading a category is listed under.

    Declaration
    public static string CategoryLabel(AchievementConditionCategory category)
    Parameters
    Type Name Description
    AchievementConditionCategory category

    The category to name.

    Returns
    Type Description
    string

    The heading.

    Remarks

    Refuses a category it cannot name, which is what holds the catalogue to naming every one it declares. Callers that draw must use TryCategoryLabel(AchievementConditionCategory, out string) instead.

    CreateInstance(Type)

    Creates a node of the given type, as Unity's polymorphic serializer would.

    Declaration
    public static AchievementCondition CreateInstance(Type conditionType)
    Parameters
    Type Name Description
    Type conditionType

    The concrete condition type to create.

    Returns
    Type Description
    AchievementCondition

    The new node, or null when the type is not a creatable condition.

    DisplayNameOf(AchievementCondition)

    The name a node is listed under, which is the node's own.

    Declaration
    public static string DisplayNameOf(AchievementCondition condition)
    Parameters
    Type Name Description
    AchievementCondition condition

    The node to name. May be null.

    Returns
    Type Description
    string

    The name.

    Remarks

    An empty slot names itself nothing rather than "None", because the header it feeds already says the slot is empty and would otherwise say it twice.

    FindEntry(Type)

    The entry a condition type is listed under, or null when it is not offered.

    Declaration
    public static AchievementConditionTypeEntry FindEntry(Type conditionType)
    Parameters
    Type Name Description
    Type conditionType

    The type to look up. May be null.

    Returns
    Type Description
    AchievementConditionTypeEntry

    The entry, or null.

    Show(Rect, Action<Type>)

    Opens the searchable, category-grouped picker anchored to a control.

    Declaration
    public static void Show(Rect anchor, Action<Type> onTypeSelected)
    Parameters
    Type Name Description
    Rect anchor

    The rect the dropdown drops from, normally the clicked button's.

    Action<Type> onTypeSelected

    Receives the picked type.

    Remarks

    The selection arrives AFTER the GUI pass that opened the dropdown, so a caller must not write through a UnityEditor.SerializedProperty it captured during that pass — the write is silently dropped. Re-find the property from its owner instead, the way AchievementConditionNodeGui does.

    TryCategoryLabel(AchievementConditionCategory, out string)

    The heading a category is listed under, when it has one.

    Declaration
    public static bool TryCategoryLabel(AchievementConditionCategory category, out string label)
    Parameters
    Type Name Description
    AchievementConditionCategory category

    The category to name.

    string label

    The heading, or null when the category has none.

    Returns
    Type Description
    bool

    True when the category has a heading.

    Remarks

    Written as an exhaustive switch with no default: so a category added later cannot be silently shelved under whatever the fallback happened to be. The drawing path asks this one rather than CategoryLabel(AchievementConditionCategory), because a picker that throws while an inspector repaints takes the whole inspector with it.

    In this article
    © 2026 Serenity. All Rights Reserved