docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class PlayerPrefsWindowLayoutStorage

    The default IWindowLayoutStorage, backed by PlayerPrefs.

    Inheritance
    object
    PlayerPrefsWindowLayoutStorage
    Implements
    IWindowLayoutStorage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 null.

    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.

    Implements

    IWindowLayoutStorage
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)