Class PlayerPrefsWindowLayoutStorage
The default IWindowLayoutStorage, backed by PlayerPrefs.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class PlayerPrefsWindowLayoutStorage : IWindowLayoutStorage
Remarks
The web component defaults to window.localStorage; the platform-native equivalent in a Unity
runtime is PlayerPrefs, which is synchronous, available in the Editor and in a player, and
intended for exactly this kind of small per-user preference.
viewDataKey was the other candidate and is deliberately not used: UI Toolkit view data is
keyed by the element's position in a serialized hierarchy rather than by a stable name the host
chooses, and it is not injectable, so it could not honour the registry's storageKey and
storage props.
Fields
instance
The shared instance used by every FloatingWindow that does not set its own storage.
Declaration
public static readonly PlayerPrefsWindowLayoutStorage instance
Field Value
| Type | Description |
|---|---|
| PlayerPrefsWindowLayoutStorage |
Methods
GetItem(string)
Reads the value stored under key, or null when there is none.
Declaration
public string GetItem(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The storage key. |
Returns
| Type | Description |
|---|---|
| string | The stored value, or |
RemoveItem(string)
Removes whatever is stored under key.
Declaration
public void RemoveItem(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The storage key. |
SetItem(string, string)
Writes value under key.
Declaration
public void SetItem(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The storage key. |
| string | value | The value to store. |