Hi friends,
I’m trying to save/load data on custom Scriptable Object, to reuse data in other sessions of game or scenes, can someone guide me with this? Thanks in advance!
Hi friends,
I’m trying to save/load data on custom Scriptable Object, to reuse data in other sessions of game or scenes, can someone guide me with this? Thanks in advance!
Thanks @LeftyRighty ,
I watched entire live training, but I didn’t found my answer
I will continue to research this topic!
If you’re talking about storing actual game / session save data at runtime, using ScriptableObjects isn’t actually beneficial over using any other arbitrary object type, since you still have to manually store it on the physical drive. All of the ScriptableObject save/load functionality is a part of the UnityEditor assembly and not included in builds, so you’ll need to save them the same way you save anything else- with a binary save system, JSON, XML, YAML (ironically), etc… You might as well use some other object type instead. Look into BinaryFormatter (for built-in data serialization), MessagePack, ZeroFormatter, JsonUtility, FullSerializer for some common serialization techniques for writing/loading objects to and from files.
Alternatively, you can use PlayerPrefs for a built-in method to do much the same thing. The only problem with this is that people can wipe out all of it by using “Clear Cache” on Android/IOS. It’s usable for any data that you don’t necessarily mind losing from time to time, like the preferred resolution and default audio volumes, etc…