logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class XboxAchievementGateway

    Reference template for mirroring unlocks to an Xbox player's achievement list through the Microsoft GDK. Reports itself unavailable and writes nothing.

    Inheritance
    object
    InertAchievementPlatformGateway
    XboxAchievementGateway
    Implements
    IAchievementPlatformGateway
    Inherited Members
    InertAchievementPlatformGateway.InitializeAsync(CancellationToken)
    InertAchievementPlatformGateway.UnlockAsync(AchievementDefinition, CancellationToken)
    InertAchievementPlatformGateway.SetProgressAsync(AchievementDefinition, long, long, CancellationToken)
    InertAchievementPlatformGateway.QueryUnlockedAsync(CancellationToken)
    InertAchievementPlatformGateway.ClearAsync(CancellationToken)
    InertAchievementPlatformGateway.PlatformName
    InertAchievementPlatformGateway.IsAvailable
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    Namespace: Serenity.Achievements.Infrastructure.Platforms.Gateways
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    public sealed class XboxAchievementGateway : InertAchievementPlatformGateway, IAchievementPlatformGateway
    Remarks

    The GDK and its Xbox Live libraries are distributed under a Microsoft developer agreement and cannot ship inside Serenity, so this type deliberately stays inert: it keeps the platform branch readable and records the call sequence a licensee needs, nothing more. Structural twin of Ps5SdkAdaptiveTriggerBackend, which solves the same problem for adaptive triggers.

    To write real achievements, implement IAchievementPlatformGateway in your own assembly — where you may reference the GDK — and register it through SetFactory(Func<IAchievementPlatformGateway>). The registry is consulted before the platform definition assets, so no Serenity source needs editing and the override survives a package update.

    What such an implementation has to do, and the knowledge this template exists to preserve:

    • Hold the XblContextHandle for the signed-in user and that user's XUID. Both come from the GDK's user model (XUserAddAsync then XblContextCreateHandle), which is the project's own sign-in flow, not the achievement gateway's.
    • Unlock and progress are the SAME call: XblAchievementsUpdateAchievementAsync(xblContext, xuid, achievementId, percentComplete), where achievementId is AchievementPlatformMapping.XboxAchievementId and 100 means unlocked. Serenity's numerator/target become a percentage on the way out.
    • Read the account back with XblAchievementsGetAchievementsForTitleIdAsync, filtering to XblAchievementsUnlockedFilter, then map each returned id back to an AchievementId through the project's own mapping.
    • There is no clear: Xbox achievements are permanent on a retail account, and the title's sandbox is the only place a developer account can be reset. Answer false rather than pretending.
    • The service configuration id and title id from UnityXboxAchievementPlatformDefinition must match the ones baked into the MicrosoftGame.config the build ships, or every call fails authentication.

    Constructors

    XboxAchievementGateway(AchievementPlatformGatewayContext)

    Initializes the Xbox template gateway.

    Declaration
    public XboxAchievementGateway(AchievementPlatformGatewayContext context)
    Parameters
    Type Name Description
    AchievementPlatformGatewayContext context

    The gateway context. Only its log service is read while inert.

    Implements

    IAchievementPlatformGateway
    In this article
    © 2026 Serenity. All Rights Reserved