Download the project files for this video here!

Hello everyone, and welcome!

In this video I show you how to create save game files in Unity using XML serialization.
This method is really easy to expand upon, and will allow you to easily create save files using whatever
information you want to store. Using XML is especially great for small teams and small projects because it keeps everything simplified and easy. However, XML documents are text documents, and, for large projects, can cause longer loading times.

Whenever I think about saving data in a game, I instantly think of all the data I’m going to have to store. After all, in programming, you want to make your code as reusable as possible to not only make multiple jobs easier for you, but also to stay organized for yourself and possibly others. So I decided I would want to use a generic class, in this case “Actor,” to allow any character or GameObject involved in the game to be saved if I want it to. The method I use in the video will make you have to spend minimal time worrying about saving or making any additions to the saving functions.

Moving on, you can improve upon the performance of this script using ID checks so only certain values have to be replaced in the xml. I also recommend using an object pooling system upon spawning serializable actors or characters.

I hope this helps you, and make sure to enjoy the video! 😉

P.S. Let me know what other topics you want me to cover in the comment section below!