Is "saving a game" covered somewhere?

Hi. I’m halfway through Glitch Garden, and thinking what I might want to do as a real project. But it occurs to me that any real game out there, mobile or computer based, will require the ability to save scores. Nobody wants to start from Level 1 everytime. Is this something that will be covered in the class, or is there information about it elsewhere?

Thanks.

Fernando

Hi Fernando,

We do not cover saving games in the Unity 2D course. However, it’s not that difficult to implement this functionality if you are fine with looking up things yourself.

Define what data needs to be saved to allow the player to proceed with the game. A simple solution in Glitch Garden would be to save the level index of the highest level the player unlocked. And if you have a score, you could save that as well. You already know everything you need to realise this idea: the PlayerPrefs, if-statements, methods, etc.

Saving the positions of all relevant game objects in the scene is a bit more complex because you cannot use the PlayerPrefs for that. You’ll have to write your own class with the things you need.

There are more free tutorials on Youtube.

Another solution could be JSON.

Also please feel free to ask our helpful community of students for advice in our official Discord chat.

I hope this helped. :slight_smile:


See also:

Thanks, that was very helpful!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms