All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams
Documentation · Quick Start · QQ Group: 467608841 / 233840761
English | 简体中文 | 繁體中文 | 日本語 | 한국어
- Typed key-value storage:
bool,int,float,string, serializable objects (via JSON) - Two built-in storage backends:
- PlayerPrefsSettingHelper (default) — uses Unity PlayerPrefs, with platform adapters for Douyin, WeChat, Kuaishou, and Alipay mini-games
- DefaultSettingHelper — file-based binary storage at
Application.persistentDataPath
- Pluggable helper architecture — implement
ISettingHelperfor custom backends - Auto-load on start, auto-save on shutdown
- Safe parsing with
TryParse— corrupted values return defaults with a warning log instead of crashing
SettingComponent (MonoBehaviour)
└─ SettingManager (ISettingManager)
└─ ISettingHelper
├─ PlayerPrefsSettingHelper (default)
└─ DefaultSettingHelper
Choose one of the following methods:
-
Edit your Unity project's
Packages/manifest.jsonand add thescopedRegistriessection:{ "scopedRegistries": [ { "name": "GameFrameX", "url": "https://gameframex.upm.alianblank.uk", "scopes": [ "com.gameframex" ] } ], "dependencies": { "com.gameframex.unity.setting": "1.5.2" } }scopescontrols which packages are resolved through this registry. Only packages whose names start withcom.gameframexwill be fetched from it. -
Add to
manifest.jsondependencies:{ "com.gameframex.unity.setting": "https://github.com/gameframex/com.gameframex.unity.setting.git" } -
Use Package Manager in Unity with Git URL:
https://github.com/gameframex/com.gameframex.unity.setting.git -
Clone the repository into your Unity project's
Packagesdirectory. It will be loaded automatically.
// The SettingComponent is automatically available after adding to a GameObject.
// Access it via GameFramework entry or GetComponent.
SettingComponent setting = ...;
// Write settings
setting.SetBool("FullScreen", true);
setting.SetInt("ResolutionWidth", 1920);
setting.SetFloat("Volume", 0.8f);
setting.SetString("PlayerName", "PlayerOne");
// Persist to storage
setting.Save();// With default fallback (returns default if key is missing or value is corrupted)
float volume = setting.GetFloat("Volume", 0.5f);
// Check existence
if (setting.HasSetting("PlayerName"))
{
string name = setting.GetString("PlayerName");
}setting.RemoveSetting("PlayerName");
setting.RemoveAllSettings();In the Inspector for SettingComponent, change Setting Helper Type Name to:
GameFrameX.Setting.Runtime.PlayerPrefsSettingHelper(default)GameFrameX.Setting.Runtime.DefaultSettingHelper(file-based)
Or assign a custom ISettingHelper via the Custom Setting Helper field.
| Backend | Standard Unity | Douyin | Kuaishou | Alipay | |
|---|---|---|---|---|---|
| PlayerPrefsSettingHelper | PlayerPrefs | TTStorage | WX SDK | KS SDK | Alipay SDK |
| DefaultSettingHelper | File I/O | File I/O | File I/O | File I/O | File I/O |
Mini-game storage support is isolated in platform adapter assemblies. The common GameFrameX.Setting.Runtime assembly only depends on GameFrameX.Runtime; install the matching mini-game SDK and enable its scripting define (ENABLE_DOUYIN_MINI_GAME, ENABLE_WECHAT_MINI_GAME, ENABLE_KUAISHOU_MINI_GAME, or ENABLE_ALIPAY_MINI_GAME) to compile the corresponding adapter.
| Property | Type | Description |
|---|---|---|
Count |
int |
Number of stored settings (-1 for PlayerPrefs backend) |
| Method | Returns | Description |
|---|---|---|
Load() |
bool |
Load settings from storage |
Save() |
bool |
Save settings to storage |
HasSetting(name) |
bool |
Check if a setting exists |
RemoveSetting(name) |
bool |
Remove a single setting |
RemoveAllSettings() |
void |
Clear all settings |
GetAllSettingNames() |
string[] |
Get all setting key names |
GetBool / SetBool |
bool |
Boolean accessors |
GetInt / SetInt |
int |
Integer accessors |
GetFloat / SetFloat |
float |
Float accessors (invariant culture) |
GetString / SetString |
string |
String accessors |
GetObject<T> / SetObject<T> |
T |
JSON-serialized object accessors |
See CHANGELOG.md for release history.
| Package | Description |
|---|---|
com.gameframex.unity |
1.1.1 |
- QQ Group: 467608841 / 233840761
Dual-licensed under MIT and Apache-2.0.