- System data for game unity
- Using Unity.Serialization to serialize binary data
- Data allows you to store data in byte[] form in blocks called profiles. Each profile is a Dictionary with the key as a string and the value
for version 1.0.0
"com.wolf-package.game-data":"https://github.com/wolf-package/game-data-unity.git#1.0.0",
- Initialize data when loading the game:
GameData.Init()
- Change Profile:
GameData.ChangeProfile(int profile)
- Load Data:
GameData.Load()
Load all data from file for game, data will be loaded automatically when starting the game - Get Data:
GameData.Get("KEY", valueDefault);
Use similar to PlayerPrefs - Set Data:
GameData.Set("KEY", value);
Use similar to PlayerPrefs - Save Data:
GameData.Save()
Save data to file (You should save when pausing or quitting the game)
private void OnApplicationPause(bool pauseStatus)
{
if(pauseStatus) GameData.Save();
}
- Has Key:
GameData.HasKey(string key)
To check if the profile has a key, - DeleteKey:
GameData.DeleteKey(string key)
To delete the key from the profile - DeleteAll:
GameData.DeleteAll()
To delete the entire key