#What's the best way to save player's progress in level?
1 messages · Page 1 of 1 (latest)
By caching the data at the point in the runtime? Many ways to do it depending if you want to refresh the state of the current scene, but if it's just character specific you're storing any player information at the time of the checkpoint and then reassigning it for when you wish to return to that checkpoint
Similarly, if you want to save the state of the scene at that point, then you're going to need to cache more information like all the enemies that you may have killed, coins collected, ect
yes, i want to save each enemy, objects that can move/rotate (for example a simple box that can be pushed by player), colleected stuff and objects that were stopped in time by the player's power to stop objects in some range in time
the problem is that i don't know how to save all of these because all ways i found to save data can only save basic variables like int, float, string etc
If you have a small enough of a game you've got options of just keeping everything in memory such that just disabling objects is ideal and keeping direct references to objects that you may want to re-enable when you go back to the checkpoint.
So what I'm trying to say is you save the starting state of all objects that can be changed at checkpoint load*
So instead of reloading the whole scene, all you need to do is look at this initial state of objects and reapply that data.
Reloading the scene entirely requires quite a bit more tinkering such as just doing a general save/load system with JSON
Combination of saving/loading state and scene reloading is probably more reasonable in this case.
the checkpoint should save the progress so player can leave the game and when they return they can continue the level
In that case, you probably just want to learn to serialize data to JSON
It's just that if it's at the runtime you have the possibility to do it by references, but otherwise you'll be doing it by ID serialization
can you please tell me how can i find whatever i need to make proper save system?
I'm not too aware of any tutorials that Unity may provide for them. I wonder if Unity Learn has anything involving them, but otherwise I usually surf around blogs and youtube for this type of information. Maybe someone has some better suggestions
https://docs.unity3d.com/6000.0/Documentation/Manual/json-serialization.html
Unity provides this json API which does the job fine despite what a lot of people say.
I would go with https://docs.unity3d.com/Packages/com.unity.nuget.newtonsoft-json@3.2/manual/index.html to keep collections like Dictionaries accessible, which could become relevant for serializing various component types.
so your idea is to convert objects to json, right? but is it good to make save files easily be changed outside of the game?
I would focus on actually creating a save file over what users do with their data. You can add layers or change the serialization logic afterwards if it bothers you.
Then you got games like Risk Of Rain 2 (made in Unity) that couldn't care for any type of encrypted data
just open a notepad and change away
@mint atlas @next lynx well thanks for help
I suggest finding a tutorial and getting an idea and if you run into trouble with your code to ask again. It's just a pretty large module to learn so it's not something I can run you through so easily.