Skip to main content

PlayerPreferenceValue<T>

An abstract class in Alta.IO, the global namespace.

Base for a typed value stored in PlayerPreferences (the local player.prefs file) under one key.

Constructors​

MemberWhat it is
protected PlayerPreferenceValue(string key, Action<string, T> setter, Func<string, T, T> getter)Creates a PlayerPreferenceValue from key, setter and getter.

Fields​

3 private and internal fields
MemberWhat it is
private readonly Func<string, T, T> getterFunction that reads a value by key with a default.
private readonly string keyPreference key the value is stored under.
private readonly Action<string, T> setterFunction that writes a value by key.

Properties​

MemberWhat it is
T Value { get; set; }Reads the stored value (default if missing) or writes a new one.

Methods​

MemberWhat it is
static T op_Implicit(PlayerPreferenceValue<T> value)Lets the preference be used directly as its value.