GameSession#
Values that outlive a scene: set in one scene, read after RuntimeScene.Load. Starts empty on each Play (or game launch). Store plain values (names, numbers, Library paths), never runtime objects, which belong to the scene that made them.
public sealed class GameSessionUsage and examples
Members: Achievements · Clear · Get · Has · Remove · Saves · Set · Stats
Achievements#
public Achievements Achievements { get; }The player's achievements, shared by every scene and kept across launches.
Clear#
public void Clear();Remove all values from this session.
Get#
public T Get<T>(string key, T fallback);Return the stored value when it has type T; otherwise return fallback.
Has#
public bool Has(string key);Whether a value is stored under this key, including a stored null.
Remove#
public void Remove(string key);Remove a key; a missing key is a no-op.
Saves#
public GameSaves Saves { get; }Initial value: GameSaves.Unavailable()
The durable save store shared by every scene in this session. Hosts configure it before scripts start.
Set#
public void Set(string key, object? value);Store or replace a value for this play session. Values are not saved to disk.
Stats#
public Stats Stats { get; }The player's stats, shared by every scene and kept across launches.
Related types#
Achievements · GameSaves · Stats
Source#
- SceneSwitching.cs