Class UnityScoreInstaller
Unity-specific installer for the Score service.
Namespace: Serenity.Score.Installation.Installers
Assembly: Serenity.UnityScore.Installation.dll
Syntax
public class UnityScoreInstaller : ScoreInstaller, IFoundationInstaller, IInstaller
Remarks
Creates the UnityScoreService and UnityScoreRepository, wires them together on a dedicated GameObject, and registers the metrics declaratively authored on an optional UnityScoreSettings asset (soft fallback to no registered metrics when none is found — a game may still register metrics in code).
Constructors
UnityScoreInstaller()
Declaration
public UnityScoreInstaller()
Methods
BuildMetricRegistry(UnityScoreSettings, ILogService)
Builds the metric registry the service is populated with. Rows with an empty
Key are skipped with a warning. When two rows share a
key, the later row wins and a warning is logged — deduping here, before Install(ILogService)
registers anything, guarantees each key is registered exactly once (a second
Register call on an already-registered key zeroes any value accumulated in
between). Public and static so the duplicate-handling policy is directly testable without
an installed asset.
Declaration
public static IReadOnlyDictionary<ScoreKey, ScoreMetricKind> BuildMetricRegistry(UnityScoreSettings settings, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityScoreSettings | settings | The score configuration, or |
| ILogService | logService | Logging service used to report skipped/duplicate rows. May be |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<ScoreKey, ScoreMetricKind> |
CreateRepository()
Creates the score repository used by the installed service. Override to swap in a different IScoreRepository backend without duplicating the rest of Install(ILogService).
Declaration
protected virtual IScoreRepository CreateRepository()
Returns
| Type | Description |
|---|---|
| IScoreRepository | The score repository. |
GetSettings()
Gets the loaded settings asset, or null when none was found.
Declaration
public UnityScoreSettings GetSettings()
Returns
| Type | Description |
|---|---|
| UnityScoreSettings |
Install(ILogService)
Installs the Score service by creating the Unity MonoBehaviour implementation with a PlayerPrefs-backed repository, then registers every metric declared on the loaded UnityScoreSettings asset.
Declaration
public override void Install(ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogService | logService | The logging service for diagnostic output. |