Git Product home page Git Product logo

prefsgui's Introduction

PrefsGUI

Accessors and GUIs for persistent preference values using a JSON file

// define PrefsParams with key.
public PrefsBool              prefsBool    = new("PrefsBool");
public PrefsInt               prefsInt     = new("PrefsInt");
public PrefsFloat             prefsFloat   = new("PrefsFloat");
public PrefsString            prefsString  = new("PrefsString");
public PrefsParam<EnumSample> prefsEnum    = new("PrefsEnum");
public PrefsColor             prefsColor   = new("PrefsColor");
public PrefsVector2           prefsVector2 = new("PrefsVector2");
public PrefsVector3           prefsVector3 = new("PrefsVector3");
public PrefsVector4           prefsVector4 = new("PrefsVector4");
public PrefsAny<CustomClass>  prefsClass   = new("PrefsClass");
public PrefsList<CustomClass> prefsList    = new("PrefsList");


public Element CreateElement(LabelElement label)
{
    return UI.Column(
        prefsBool.CreateElement(),
        prefsInt.CreateElement(),
        prefsFloat.CreateElement(),
        prefsFloat.CreateSlider(),
        prefsString.CreateElement(),
        prefsEnum.CreateElement(),
        prefsColor.CreateElement(),
        prefsVector2.CreateElement(),
        prefsVector2.CreateSlider(),
        prefsVector3.CreateElement(),
        prefsVector3.CreateSlider(),
        prefsVector4.CreateElement(),
        prefsVector4.CreateSlider(),
        prefsClass.CreateElement(),
        prefsList.CreateElement()
    );
}

Installation

This package uses the scoped registry feature to resolve package dependencies.

Edit > ProjectSettings... > Package Manager > Scoped Registries

Enter the following and click the Save button.

"name": "fuqunaga",
"url": "https://registry.npmjs.com",
"scopes": [ "ga.fuquna" ]

Window > Package Manager

Select MyRegistries in Packages:

Install PrefsGUI - RosettaUI and RosettaUI - UIToolkit
If you prefer IMGUI, select the PrefsGUI - RapidGUI instead.

If you do not see it, make sure that your Unity version is 2021.3 or higher.

JSON file path

Application.persistentDataPath + "/Prefs.json"

You can customize it by placing PrefsKvsPathCustom in the scene and setting the Path field.
Special folder names and environment variables are also available.

- %dataPath% -> Application.dataPath
- %companyName% -> Application.companyName
- %productName% -> Application.productName
- other %[word]% -> System.Environment.GetEnvironmentVariable([word])

PrefsSearch

Display loaded PrefsParams with a partial key match.

EditorWindow

Window -> PrefsGUI

  • Display all loaded PrefsParams that can be modified.
  • Feed back the current value as a default value.
  • Edit the key prefix for each GameObject.

PrefsMaterialProperty

Auto-create material menu.

Sync PrefsParams over a network

see PrefsGUISyncForMirror

References

prefsgui's People

Contributors

favoyang avatar fuqunaga avatar innovative-ideas avatar semantic-release-bot 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.