Skip to content

System game data unity (Unity 2022.3)

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

wolf-package/game-data-unity

Repository files navigation

Made With Unity License Last Commit Repo Size Last Release

What

  • System data for game unity (Unity 2022.3)
  • 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

How To Install

Add the line below to Packages/manifest.json

for version 1.0.1

"com.wolf-package.game-data":"https://github.com/wolf-package/game-data-unity.git#1.0.1",

Use

  • Initialize data when loading the game: GameData.Init() Data will be init (Load Data) automatically when game starts
  • Change Profile: GameData.ChangeProfile(int profile)
  • Load Data: GameData.Load() Load all data from file for 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
  • Backup: GameData.Backup() Get raw byte[] of all data of profile
  • Restore: GameData.Restore(byte[] bytes) Load from byte[]