Class RemotePlayerPrefs

Namespace: AppMana.ComponentModel

This class wraps PlayerPrefs and stores values in their page's local storage.

public class RemotePlayerPrefs : IDisposable

Inheritance

object ← RemotePlayerPrefs

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields

localStorageKey

protected const string localStorageKey = "appmanaPlayerPrefs"

Field Value

string

Methods

DeleteAll()

public void DeleteAll()

DeleteKey(string)

Deletes the specified preference key.

public void DeleteKey(string key)

Parameters

key string

the key

Dispose()

Disposes the instance.

public void Dispose()

GetFloat(string, float)

public float GetFloat(string key, float defaultValue = 0)

Parameters

key string

defaultValue float

Returns

float

GetInt(string, int)

public int GetInt(string key, int defaultValue = 0)

Parameters

key string

defaultValue int

Returns

int

GetString(string, string)

public string GetString(string key, string defaultValue = "")

Parameters

key string

defaultValue string

Returns

string

HasKey(string)

Checks if a key has been saved into the player's player preferences.

public bool HasKey(string key)

Parameters

key string

the key

Returns

bool

true if the key has been set

Save()

Saves the player preferences.

public UniTask Save()

Returns

UniTask

Remarks

The Unity API requires users to explicitly save changes to player preferences.

SetFloat(string, float)

public void SetFloat(string key, float value)

Parameters

key string

value float

SetInt(string, int)

public void SetInt(string key, int value)

Parameters

key string

value int

SetString(string, string)

public void SetString(string key, string value)

Parameters

key string

value string