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()
);
}
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.
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])
Display loaded PrefsParams with a partial key match.
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.
Auto-create material menu.
see PrefsGUI-PostProcessingURP
- UV Checker Map Maker(CustomUVChecker_byValle_1K.png)
- RosettaUI
- RapidGUI
- PrefsGUISyncForMirror