public void LoadMap()
        {
            // Reading the XML document
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(mapTMX.text);

            // Creates the map with the document
            map = new MapXml(xmlDocument);

            // In case another Map was loaded, deletes it
            string mapTitle = map.properties["Title"];

            if (mapTitle == null)
            {
                mapTitle = "Map";
            }

            Transform mapTransform = transform.FindChild(mapTitle);

            if (mapTransform != null)
            {
                mapObject = mapTransform.gameObject;
            }

            if (mapObject != null)
            {
                if (mapObject.name == mapTitle)
                {
                    DestroyImmediate(mapObject);
                }
            }

            // Instantiates the container object where the tiles will be put in
            mapObject                  = new GameObject(name);
            mapObject.name             = mapTitle;
            mapObject.transform.parent = transform;

            //Map mapScript = mapObject.AddComponent<Map>();
            //mapScript.name = mapTitle;
            //mapScript.clampsCamera = map.GetProperty("clamps") != null ? bool.Parse(map.GetProperty("clamps")) : false;
            //mapScript.mapXml = map;

            // Makes the magic!11!11!
            drawLayers();
            instantiateObjects();
        }
        public void LoadMap()
        {
            // Reading the XML document
            XmlDocument xmlDocument = new XmlDocument ();
            xmlDocument.LoadXml (mapTMX.text);

            // Creates the map with the document
            map = new MapXml (xmlDocument);

            // In case another Map was loaded, deletes it
            string mapTitle = map.properties["Title"];
            if (mapTitle == null)
                mapTitle = "Map";

            Transform mapTransform = transform.FindChild (mapTitle);
            if (mapTransform != null)
                mapObject = mapTransform.gameObject;

            if (mapObject != null) {
                if (mapObject.name ==  mapTitle) {
                    DestroyImmediate(mapObject);
                }
            }

            // Instantiates the container object where the tiles will be put in
            mapObject = new GameObject(name);
            mapObject.name = mapTitle;
            mapObject.transform.parent = transform;

            //Map mapScript = mapObject.AddComponent<Map>();
            //mapScript.name = mapTitle;
            //mapScript.clampsCamera = map.GetProperty("clamps") != null ? bool.Parse(map.GetProperty("clamps")) : false;
            //mapScript.mapXml = map;

            // Makes the magic!11!11!
            drawLayers();
            instantiateObjects();
        }