logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class CustomCondition

    Delegates to a rule the project wrote itself, named by type and resolved through the evaluation context's IAchievementCustomConditionResolver.

    Inheritance
    object
    CustomCondition
    Namespace: Serenity.Achievements.Infrastructure.Conditions
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    [AchievementConditionCategory(AchievementConditionCategory.Code)]
    public class CustomCondition : AchievementCondition
    Remarks

    The escape hatch the primitives are designed around: everything a project can express by composing signals, scores, progress and time is authored, and everything else is a class. The resolved instance is cached per node, because resolution walks loaded assemblies and an evaluation may run every frame.

    Constructors

    CustomCondition()

    Creates an unauthored condition, as Unity's polymorphic serializer does.

    Declaration
    public CustomCondition()

    CustomCondition(string)

    Creates a condition delegating to a project-supplied rule.

    Declaration
    public CustomCondition(string conditionTypeName)
    Parameters
    Type Name Description
    string conditionTypeName

    The type name of the rule to delegate to.

    Properties

    ConditionTypeName

    The type name of the project-supplied rule.

    Declaration
    public string ConditionTypeName { get; }
    Property Value
    Type Description
    string

    DisplayName

    Declaration
    public override string DisplayName { get; }
    Property Value
    Type Description
    string

    NeedsTick

    Polled, because a project-supplied rule reads whatever it likes and this node cannot know what would notify it. A custom rule that only cares about a signal is cheap to ask.

    Declaration
    public override bool NeedsTick { get; }
    Property Value
    Type Description
    bool

    Methods

    Describe(bool)

    Declaration
    public override string Describe(bool isNested)
    Parameters
    Type Name Description
    bool isNested
    Returns
    Type Description
    string

    GetProgress(in AchievementEvaluationContext)

    Declaration
    public override AchievementConditionProgress GetProgress(in AchievementEvaluationContext context)
    Parameters
    Type Name Description
    AchievementEvaluationContext context
    Returns
    Type Description
    AchievementConditionProgress

    IsMet(in AchievementEvaluationContext)

    Declaration
    public override bool IsMet(in AchievementEvaluationContext context)
    Parameters
    Type Name Description
    AchievementEvaluationContext context
    Returns
    Type Description
    bool

    Reset()

    Declaration
    public override void Reset()

    Validate()

    Declaration
    public override string Validate()
    Returns
    Type Description
    string

    ValidateAgainst(IAchievementCustomConditionResolver)

    Validates against a live resolver, which is the only way to tell a renamed or deleted type from one that simply is not loaded yet.

    Declaration
    public string ValidateAgainst(IAchievementCustomConditionResolver resolver)
    Parameters
    Type Name Description
    IAchievementCustomConditionResolver resolver

    The resolver to check against. Null skips the check.

    Returns
    Type Description
    string

    What is wrong, or null when the node is valid.

    Remarks

    Separate from Validate() because that one takes no arguments: a node cannot reach a resolver on its own, so the authoring rules — which have one — ask this instead. Kept as its own method, rather than folded into the override, so a caller holding a CustomCondition reference can validate it without going through the base's polymorphic ValidateCustomRule(IAchievementCustomConditionResolver).

    ValidateCustomRule(IAchievementCustomConditionResolver)

    Declaration
    public override string ValidateCustomRule(IAchievementCustomConditionResolver resolver)
    Parameters
    Type Name Description
    IAchievementCustomConditionResolver resolver
    Returns
    Type Description
    string
    In this article
    © 2026 Serenity. All Rights Reserved