Chapter 8. Working with External Text Files and XML Data

In this chapter, we will cover:

  • Loading external text files using the TextAsset public variable
  • Loading external text files using C# file streams
  • Saving external text files with C# file streams
  • Loading and parsing external XML files
  • Creating XML text data manually using XMLWriter
  • Creating XML text data automatically through serialization
  • Creating XML text files – saving XML directly to text files with XMLDocument.Save()

Introduction

Text-based external data is very common and very useful as it is both computer and human readable. Text files may be used to allow non-technical team members to edit written content or for recording game performance data during development and testing. There is a lot of XML-based text file data on the Web, which is why we have included several XML-specific file reading and writing methods.

In the previous chapter, three general methods for loading external resource files were demonstrated, all of which work for text files as well as textures and audio files. Several additional methods for loading text files in particular are presented in this chapter.

All the recipes in this chapter are closely related.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.59.198