logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class PlayStationAchievementGateway

    Reference template for awarding PlayStation Network trophies. Reports itself unavailable and writes nothing.

    Inheritance
    object
    InertAchievementPlatformGateway
    PlayStationAchievementGateway
    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 PlayStationAchievementGateway : InertAchievementPlatformGateway, IAchievementPlatformGateway
    Remarks

    Trophies are awarded through Sony's licensed SDK, whose headers are under NDA and cannot ship inside Serenity. This type therefore stays inert: it keeps the platform branch readable and records the call sequence a licensee needs. Structural twin of Ps5SdkAdaptiveTriggerBackend, which solves the same problem for adaptive triggers.

    PS5 only. Serenity's minimum editor is Unity 6, whose PlayStation support is the PS5 module, so UNITY_PS4 is out of scope rather than a second branch to keep in step.

    To award real trophies, implement IAchievementPlatformGateway in your own assembly — where you may reference the SDK — 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:

    • Register the trophy pack once per user with the SDK's trophy-system registration call, passing the service label from UnityPlayStationAchievementPlatformDefinition. The pack is authored in Sony's trophy tool, not by Serenity; the ids in AchievementPlatformMapping.PsnTrophyId must be the pack's own numeric ids.
    • Unlock with the trophy context's UnlockTrophy(trophyId). "Already unlocked" comes back as a distinct result and is a success, not a failure — a reinstall replays it.
    • Progress applies only to trophies the pack declares as progress trophies, through the SDK's SetTrophyProgress. A plain trophy answers an error; treat that as "nothing to report" rather than as a fault.
    • Never award the platinum. The system awards it automatically once its prerequisites are met, and a title that unlocks it explicitly fails certification.
    • Reading the account back is GetTrophyUnlockState, which answers a bitmask over the pack's trophy ids — map those back to AchievementId through the project's own mapping.
    • There is no clear on a retail account. Only a development kit can reset a trophy pack, through the platform's own tooling, so answer false rather than pretending.

    Constructors

    PlayStationAchievementGateway(AchievementPlatformGatewayContext)

    Initializes the PlayStation template gateway.

    Declaration
    public PlayStationAchievementGateway(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