Saving, Loading, and Serializing Data

Every game you’ve ever played works with data, whether it’s your player stats, game progress, or online multiplayer scoreboards. Your favorite game also manages internal data, meaning the programmers used hardcoded information to build levels, keep track of enemy stats, and write helpful utilities. In other words, data is everywhere.

In this chapter, we’re going to start with how both C# and Unity handle the filesystem on your computer, and move on to reading, writing, and serializing our game data. Our focus is on working with the three most common data formats you’ll likely come across: text files, XML, and JSON.

By the end of this chapter, you’ll have a foundational understanding of your computer’s ...

Get Learning C# by Developing Games with Unity - Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.