Save System
A basic save system based on unity's JsonUtility
Last updated
Was this helpful?
A basic save system based on unity's JsonUtility
Last updated
Was this helpful?
The save system is built on Unity's which saves an object in a .json file. All the saves are located at which is located at C:\Users\<user>\AppData\LocalLow\<company name>
on widows.
SaveObject
Saves the target object as a .json
file in the designated save path.
LoadObject
Loads and deserializes the .json
file with the specified name into the target generic type.
LoadAllObjects
Loads all .json
files from the save path and deserializes them into the specified generic type.
DeleteFile
Deletes the .json
file with the specified name from the save path.
DeleteAllFiles
Deletes all .json
files in the save path, effectively clearing all saved data stored in that location.
Save
Saves a key with its value, similar to PlayerPrefs.SetKey()
. This allows you to store data persistently between game sessions.
Load
Loads a key with its value, similar to PlayerPrefs.GetKey().
HasKey
Returns true
if the Key list contains the specified key.
To start using the save system, first add the FPSFramework namespace to the class you want to save and load from, like this:
Now create a new class like this:
In Start(), call SaveSystem.Load(), and in OnApplicationQuit(), call SaveSystem.Save() inside the class you want to save and load from, like this: