logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityAchievementEvaluatorRunner

    The frame loop the achievement evaluator needs: ticks the time-driven condition trees every frame, and runs a recovery pass on a backing-off schedule that re-attempts the platform sync and re-resolves any signal type the binder could not find at boot.

    Inheritance
    object
    UnityAchievementEvaluatorRunner
    Namespace: Serenity.Achievements.Infrastructure.Components
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    public class UnityAchievementEvaluatorRunner : MonoBehaviour
    Remarks

    Created by the installer, parked under DontDestroyOnLoad, and owner of the binder's lifetime: disposing this component unsubscribes every achievement subscription, so a torn down composition leaves nothing listening.

    Exactly one runner exists at a time. Create(AchievementEvaluator, IAchievementService, AchievementSignalSubscriptionBinder, ITimeProvider, AchievementSyncBackoff, Func<bool>, ILogService) destroys the previous host before building a new one, because a second runner would tick every tree twice per frame and run two overlapping recovery passes against the same service.

    Deliberately thin. Everything about "is an attempt due and how long until the next one" lives in AchievementSyncBackoff, which is engine-free and unit-tested; this component only supplies frames and calls.

    Constructors

    UnityAchievementEvaluatorRunner()

    Declaration
    public UnityAchievementEvaluatorRunner()

    Methods

    Create(AchievementEvaluator, IAchievementService, AchievementSignalSubscriptionBinder, ITimeProvider, AchievementSyncBackoff, Func<bool>, ILogService)

    Creates the runner on its own persistent GameObject and starts it.

    Declaration
    public static UnityAchievementEvaluatorRunner Create(AchievementEvaluator evaluator, IAchievementService service, AchievementSignalSubscriptionBinder binder, ITimeProvider timeProvider, AchievementSyncBackoff backoff, Func<bool> isPlatformReady, ILogService logService)
    Parameters
    Type Name Description
    AchievementEvaluator evaluator

    The evaluator to tick.

    IAchievementService service

    The service the platform-sync retry goes through.

    AchievementSignalSubscriptionBinder binder

    The signal subscriptions this runner owns and re-attempts. May be null.

    ITimeProvider timeProvider

    Frame timings source. May be null; Time.deltaTime is used then.

    AchievementSyncBackoff backoff

    The recovery schedule.

    Func<bool> isPlatformReady

    Answers whether the platform session is up, deciding whether a pass counts as recovered. May be null when no platform is configured.

    ILogService logService

    Logging service. May be null.

    Returns
    Type Description
    UnityAchievementEvaluatorRunner

    The started runner.

    Remarks

    An earlier runner, if any, is destroyed first — one frame loop, one binder.

    Initialize(AchievementEvaluator, IAchievementService, AchievementSignalSubscriptionBinder, ITimeProvider, AchievementSyncBackoff, Func<bool>, ILogService)

    Wires the runner's collaborators. Called by Create(AchievementEvaluator, IAchievementService, AchievementSignalSubscriptionBinder, ITimeProvider, AchievementSyncBackoff, Func<bool>, ILogService).

    Declaration
    public void Initialize(AchievementEvaluator evaluator, IAchievementService service, AchievementSignalSubscriptionBinder binder, ITimeProvider timeProvider, AchievementSyncBackoff backoff, Func<bool> isPlatformReady, ILogService logService)
    Parameters
    Type Name Description
    AchievementEvaluator evaluator

    The evaluator to tick.

    IAchievementService service

    The service the platform-sync retry goes through.

    AchievementSignalSubscriptionBinder binder

    The signal subscriptions this runner owns and re-attempts. May be null.

    ITimeProvider timeProvider

    Frame timings source. May be null.

    AchievementSyncBackoff backoff

    The recovery schedule. May be null to disable recovery passes.

    Func<bool> isPlatformReady

    Answers whether the platform session is up. May be null.

    ILogService logService

    Logging service. May be null.

    In this article
    © 2026 Serenity. All Rights Reserved