Howdy! To watch this entire Gametutor course please Register  or log in

Getting Cozy With
XML For Unity
Course Description
Learning how to save your data in and out of your own application becomes very important, the more you start to dive into C#. When it comes to game development, we are always looking to allow users to save out level data, high scores, user accounts, etc. Throughout this course, we will look at three different ways in which you can create xml files from the data generated in your game.
We will get very cozy with the creation of XML files, inside of Unity and learn more advanced ways of serializing our classes using the built in methods given to us by C#. By the end of this course, you will have learned how to use the XMLDocument class, the XMLreader and XMLWriter classes, and finally how to use the XMLSerializer class.
Course Details
Difficulty: Intermediate
Total Lessons: 8 Lessons
Running Time: 01:31:34
Date: 2/20/15
Course Files
This is a premium course. Source files are available only to Rockstar and Apprentice members. Please Log In or Upgrade your account to unlock these files.
Locked Source File Icon
File Name: Gatu_GettingCozyWithXML.ZIP
File Size: 161.24 KB
Complete Unity packages and projects for all course material including project, library, scripts, scene and asset files. If it's in the video it's in the source!
Course Lessons

1. Setting up the DEV Environment

In our first lesson we are going to get a simple editor window up and running, and get our development environment set up in general.

2. Writing an XML Document

So lets get started with XML, by taking a look at the most basic way to create a new XML file. By the end of this lesson you will have learned how to use the XMLDocument class, in C#, as well as have created your first XML file.

3. Reading an XML Document

With our first XML Document created, lets take a look at how we can utilize the most basic way in C#, to read the contents of an XML file. This will create a full data pipeline, that allows you to read and write xml files, for your tools and or games.

4. Using the XMLWriter Class

Now that we have looked and learned how we can create xml from a very basic standpoint, lets take a look at a second way that C# provides, to create xml files. Using this new technique will save you time and the amount of code you need to write in order to add XML functionality to your interactive applications.

5. Using the XMLReader Class

Alright! So now we have reduced the effort in creating an XML File, lets take a look at how to read in the XML file, using the XMLReader class. This will also reduce the amount of code required to read XML files, but is a bit different from the more simple XMLDocument technique.

6. Serializing with XML

Serializing data becomes very important when you start working with dynamic tools and more real time updates in your games. Serializing data simply means that we convert our C# classes into XML. This technique starts to get a bit more advanced as we take a look at creating our data storage classes, and how to use Text Streams to send a classes state to XML. By the end of this lesson you will see just how clean and organized this technique is, to write to XML.

7. Deserializing with XML

With our new Serialization functionality up and running, lets take a look how we can use Deserialization to convert our XML file back into proper C# objects. Utilizing this technique reduces coding time, and keeps your serialization time down to a minimum.

8. Conclusion

Let’s re-cap what we have learned, and how we can take it further. This isn’t the last of the XML course on Gametutor, but it is a great place to start if you aren’t familiar with writing data to an external file format.