logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityAchievementDefinition

    One authored achievement: what the player sees, what it awards, what unlocks it, and which storefront identifiers it is mirrored under.

    Inheritance
    object
    UnityAchievementDefinition
    Implements
    IFoundationSettings
    Namespace: Serenity.Achievements.Infrastructure.Settings
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    public class UnityAchievementDefinition : ScriptableObject, IFoundationSettings
    Remarks

    One asset per achievement rather than a list on UnityAchievementSettings, because a project ships hundreds of them and a list that long is unreviewable, un-mergeable and reloaded whole for a one-field edit. The module discovers them by the module:achievements Addressables label the way waves and cutscenes are discovered, so adding an achievement is adding a file.

    Condition is stored through [SerializeReference], so the whole authored tree lives inside this asset and no second asset has to be kept in step with it. An achievement with no condition is complete and normal: only a code call to IAchievementService.UnlockAsync or an UnlockAchievementSignal unlocks it.

    Constructors

    UnityAchievementDefinition()

    Declaration
    public UnityAchievementDefinition()

    Fields

    Condition

    Declaration
    public AchievementCondition Condition
    Field Value
    Type Description
    AchievementCondition

    DescriptionKey

    Declaration
    public string DescriptionKey
    Field Value
    Type Description
    string

    DisplayOrder

    Declaration
    public int DisplayOrder
    Field Value
    Type Description
    int

    EpicAchievementId

    Declaration
    public string EpicAchievementId
    Field Value
    Type Description
    string

    Grade

    Declaration
    public TrophyGrade Grade
    Field Value
    Type Description
    TrophyGrade

    Guid

    Declaration
    public string Guid
    Field Value
    Type Description
    string

    GUID for this achievement asset.

    Icon

    Declaration
    public Sprite Icon
    Field Value
    Type Description
    Sprite

    Id

    Declaration
    public string Id
    Field Value
    Type Description
    string

    Unique identifier for this achievement. Also the key every unlock row is stored under.

    IsHidden

    Declaration
    public bool IsHidden
    Field Value
    Type Description
    bool

    IsTranslating

    Declaration
    public bool IsTranslating
    Field Value
    Type Description
    bool

    NameKey

    Declaration
    public string NameKey
    Field Value
    Type Description
    string

    Points

    Declaration
    public int Points
    Field Value
    Type Description
    int

    ProgressTarget

    Declaration
    public long ProgressTarget
    Field Value
    Type Description
    long

    PsnTrophyId

    Declaration
    public string PsnTrophyId
    Field Value
    Type Description
    string

    SteamApiName

    Declaration
    public string SteamApiName
    Field Value
    Type Description
    string

    XboxAchievementId

    Declaration
    public string XboxAchievementId
    Field Value
    Type Description
    string

    Methods

    ToAuthoringSnapshot(IReadOnlyCollection<AchievementPlatformKind>)

    Describes this achievement to the engine-free authoring rules, so the same checks can run wherever the achievement is read: the inspector does today, and the project validator and a headless CI pass are meant to once a later slice wires them up.

    Declaration
    public AchievementAuthoringSnapshot ToAuthoringSnapshot(IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms = null)
    Parameters
    Type Name Description
    IReadOnlyCollection<AchievementPlatformKind> enabledPlatforms

    The storefronts this project ships on, which is what makes a missing identifier a finding. May be null.

    Returns
    Type Description
    AchievementAuthoringSnapshot

    The snapshot.

    TryToDefinition(out AchievementDefinition, out string)

    Converts this asset into the runtime definition the achievement registry is built from, or explains why it cannot be.

    Declaration
    public bool TryToDefinition(out AchievementDefinition definition, out string error)
    Parameters
    Type Name Description
    AchievementDefinition definition

    The runtime definition, or null when this asset is not usable.

    string error

    What is wrong with this asset, or null when it is usable.

    Returns
    Type Description
    bool

    true when the definition was produced.

    Remarks

    A pair rather than a throwing conversion because the caller is a loader holding every achievement in the project: one unusable asset must cost that achievement and nothing else, and the reason has to reach the author as a message rather than as a stack trace.

    Implements

    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved