The pieces

Prefs

static

Named values reachable from anywhere with no reference and no setup, in the shape of PlayerPrefs. The values live in the single PersistentPrefs asset, and Manager is the Persistence Manager that decides where they are stored, when they load and when they save. With no asset in the project, a read answers with its fallback, a write does nothing, and the console says so once. Explained in Prefs.

PersistenceManager Manager { get; }The PersistenceManager the values are saved and loaded by: readiness, the operations and the storage settings are its own. Null when the project has no prefs asset, or its asset has no manager, which the console reports.
PersistentPrefs Asset { get; }The asset the values live in, for what takes the object itself: the Slots members, a PersistentVariables field on a component, and the id members. Null when the project has none. Every value on it is reachable on Prefs too.
event Action<string> OnChangedRaised with the key after any change: a value set, or a mutation of a list or map.
event Action OnReloadedRaised after the whole bag is reloaded or reset (a load, an import, a reset to defaults, a RemoveAll).
IReadOnlyList<string> Keys { get; }Every key currently defined, in definition order. A copy taken as you ask for it.
int Count { get; }How many keys are defined.
void Set<T>(string key, T value)Write a value, creating the key when absent. Writing an equal value-type or string is a no-op. Throws ArgumentException (null/empty key, or null untyped value), NotSupportedException (no registered variable type for T), InvalidOperationException (the key exists with an incompatible type or shape).
bool TrySet<T>(string key, T value)Write a value like Set, returning false instead of throwing when the key is empty, T is unregistered, or the key holds an incompatible type or shape.
T Get<T>(string key, T fallback = default)Read a value, or fallback when the key is missing or its stored type is not compatible with T.
bool TryGet<T>(string key, out T value)Read a value, returning false when the key is missing or not compatible with T.
bool Has(string key)Whether a value is stored under that key.
Type TypeOf(string key)The type stored under a key, null when it does not exist or its type is not registered.
bool IsList(string key) / IsMap(string key)Whether the key exists and holds a list, or a map.
string ValueAsText(string key)A value as text, whatever its type: what a label shows. Empty when there is no such key. Never throws.
VariableList<T> GetList<T>(string key)The live list behind a key (created empty when absent), null when the project has no prefs asset. Throws ArgumentException (null/empty key), NotSupportedException (no registered type), InvalidOperationException (key exists with a different shape/type).
bool TryGetList<T>(string key, out VariableList<T> list)The list when it already exists, false when it is missing or holds another type. Unlike GetList, it never creates one.
VariableMap<TKey, TValue> GetMap<TKey, TValue>(string key)The live map behind a key (created empty when absent), null when the project has no prefs asset. Throws ArgumentException (null/empty key), NotSupportedException (no registered type), InvalidOperationException (key exists with a different shape/type).
bool TryGetMap<TKey, TValue>(string key, out VariableMap<TKey, TValue> map)The map when it already exists, false when it is missing or holds other types. Unlike GetMap, it never creates one.
void NotifyChanged(string key)Flag a key changed after mutating a reference-type value in place (an AnimationCurve, a Gradient), which the bag cannot detect on its own.
bool Remove(string key)Remove one key, returning false when it was not there, or when the project has no prefs asset.
void RemoveAll()Remove every key from the live values. A save then persists the empty state; Manager.Clear() is what also empties storage.
bool ResetVariable(string key)Put one key back to the value authored in the asset's inspector, matched by its stable id so a rename does not affect it. A key that is not authored is removed. False when the authored baseline is not captured yet, which happens on the first load.
bool ResetVariable(params string[] keys)Reset several keys, each like the single-key overload; false when any key given was not reset.

PersistentPrefs

SOsealed

The one PersistentVariables asset behind Prefs. Code reaches its values through Prefs, which carries them all; the asset itself is what you drag onto the no-code components and what holds the authored defaults. One project holds one of them, created for you in the editor and found by its type rather than by a reference. It drives its manager's Always Global on, which is what keeps it loaded and reachable. Explained in Prefs.

PersistencePolicy Policy { get; }Forces Always Global on. Every other manager setting (storage, slots, auto save, protection) stays the manager's own.