Giter Club home page Giter Club logo

unityprojectpreferences's Introduction

UnityProjectPreferences

Similar to Unity's built-in EditorPrefs, but relative to a single project. And more versatile.

Project preferences are stored as binary data in the project directory. Changes will be saved automatically on domain reload and on quitting the editor. The ProjectPrefs class provides ways to interface with the stored data:

Method Signature Description
public static void Save () Write all current keys and their values to the preferences file.
public static bool SetValue (PrefKey key, PrefValue value) Attempts to set the value associated with the given key.
Will always replace existing values.
public static bool SetValue (PrefKey key, PrefValue value, ValueOverrideOption overrideOption) Attempts to set the value associated with the given key.
Whether existing values are replaced, depends on the given .
Returns true if the value was set, otherwise false.
public static object GetValue (PrefKey key) Gets the value associated with the given key as an .
The value associated with the given key as an object. Otherwise null.
public static bool TryGetValue (PrefKey key, out object value) Attempts to get the value associated with the given key.
Returns true if the key exists in the preferences, otherwise false.
public static bool GetBool (PrefKey key, bool fallback)
public static int GetInt (PrefKey key, int fallback)
public static string GetString (PrefKey key, string fallback)
public static float GetFloat (PrefKey key, float fallback)
public static bool TryGetBool (PrefKey key, out bool value)
public static bool TryGetInt (PrefKey key, out int value)
public static bool TryGetString (PrefKey key, out string value)
public static bool TryGetFloat (PrefKey key, out float value)
public static bool HasKey (PrefKey key) Checks whether a given key exists in the preferences.
public static bool HasKey (Func<PrefKey, bool> filter) Checks whether any key exists in the preferences, that matches a given filter.
public static bool DeleteKey (PrefKey key) Deletes a given key from the preferences.
public static int DeleteKeys (Func<PrefKey, bool> filter) Deletes all keys from the preferences, that match a given filter.
public static List<PrefKey> GetKeys (Func<PrefKey, bool> filter) Returns a collection of all keys in the preferences, that match a given filter.
public static void DeleteAll () Clears out all keys in the preferences.

unityprojectpreferences's People

Contributors

zenvin-dev avatar

Stargazers

Mr.Hu avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.