inquire about different data structures

I’ve been using unity for a long time but i recently noticed that many projects include different data structure like XML and Json, so I’d like someone to briefly explain why and when do we use those and how they’re going to have an impact on my game.

Thanks !

Although I haven’t yet used json yet, I do use XML for my level designing stuff. So I simply have to hand over the XML to my level designer who is not a programmer. Although there should also be others uses, this is how I use it.
Here is part of my level file :


And here is the script which loads these parameters :

using UnityEngine;
using System.Collections;
using System.Xml;  
	public class levelLoader : MonoBehaviour
	public TextAsset levelFile;
	private XmlDocument xmldoc = new XmlDocument (); 
	//Level file parameters
	private int INIT_SHRINK = 0;
	private int BEGIN_COLOR_UPDATE_AT = 0;
	private int BEGIN_SHADE_UPDATE_AT = 0;
	private int AT_LEVEL = 0;
	private int SHRINK_RATE = 0;
	private int[,] shrinkVariant = new int[,] {
	void Start(){
		xmldoc.LoadXml (levelFile.text);
		XmlNodeList nodelist = xmldoc.GetElementsByTagName ("INIT_SHRINK");
		INIT_SHRINK = int.Parse (nodelist [0].InnerText);

		nodelist = xmldoc.GetElementsByTagName ("BEGIN_COL_UPD_AT");
		BEGIN_COLOR_UPDATE_AT = int.Parse (nodelist [0].InnerText);	 
		nodelist = xmldoc.GetElementsByTagName ("SHADE_UPD_EVERY"); 
		BEGIN_SHADE_UPDATE_AT = int.Parse (nodelist [0].InnerText);
		nodelist = xmldoc.GetElementsByTagName ("SHRINK_VARIANT");
		XmlNodeList shrinkVaraintList = nodelist.Item (0).ChildNodes;

		for (int v = 0; v<shrinkVaraintList.Count; v++) {
			XmlNodeList shrinkVarParamList = shrinkVaraintList.Item (v).ChildNodes;

			for (int p=0; p<shrinkVarParamList.Count; p++) {
				if (p == 0) 
					AT_LEVEL = int.Parse (shrinkVarParamList [p].InnerText);
				if (p == 1) 
					SHRINK_RATE = int.Parse (shrinkVarParamList [p].InnerText);

shrinkVariant [v, p] = int.Parse (shrinkVarParamList [p].InnerText);


Hope it helps. :slight_smile: