logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityScoreRepository

    Unity implementation of IScoreRepository using PlayerPrefs for persistence.

    Inheritance
    object
    UnityScoreRepository
    Implements
    IScoreRepository
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Score.Infrastructure.Repositories
    Assembly: Serenity.UnityScore.Infrastructure.dll
    Syntax
    public class UnityScoreRepository : IScoreRepository
    Remarks

    Stores score records as JSON strings in PlayerPrefs, keyed by metric name. Suitable for lightweight, local-only score storage.

    Constructors

    UnityScoreRepository()

    Declaration
    public UnityScoreRepository()

    Fields

    _records

    Declaration
    protected readonly List<ScoreRecord> _records
    Field Value
    Type Description
    List<ScoreRecord>

    Methods

    Clear()

    Declaration
    public virtual void Clear()

    LoadAll()

    Declaration
    public virtual ScoreRecord[] LoadAll()
    Returns
    Type Description
    ScoreRecord[]

    Save(ScoreSnapshot)

    Declaration
    public virtual void Save(ScoreSnapshot snapshot)
    Parameters
    Type Name Description
    ScoreSnapshot snapshot

    TryLoadLatest(out ScoreRecord)

    Declaration
    public virtual bool TryLoadLatest(out ScoreRecord record)
    Parameters
    Type Name Description
    ScoreRecord record
    Returns
    Type Description
    bool

    Implements

    IScoreRepository
    In this article
    © 2026 Serenity. All Rights Reserved