Static classes cannot be allocated, therefore there can be only one of them in which every method and variable must also be static. They can be used to load in files and store variables from them, such as settings, as well as wrap up methods you know will be needed in multiple places. Static classes are never deallocated which makes them really useful for keeping data around between scenes in Unity, like textures which would save on loading times.
 |
Static class to add and remove textures at will |
XML was designed to be easily read by people as well as computers. All XML files must begin with the header of
<?xml version="1.0" encoding="utf-8" ?> . From there you have to define an element which will be the name to call when needing the data inside (similar to a class). Inside that other elements can be defined which contain the precise data you require, in the form of a 'Key Value' pair e.g <player
lives="3"/>. Every value is recorded as a string.
To use an XML file, you need to first parse it into Unity and then select the base element you want. Then you can walk through any children and use the key/value pairs as needed.
 |
XML parsing class |
No comments:
Post a Comment