void LoadMap() { Debug.Log("Creating World..."); string data = mapReader(); var lines = data.Split('\n'); for (int row = 0; row < lines.Length; row++) { var line = lines[row].ToCharArray(); for (int col = 0; col < line.Length; col++) { var c = line[col]; var tile = tiles.GetPrefab(c); if (tile != null) { var x = col * tileWidth; var y = -row * tileHeight; createdTiles.Add(Instantiate(tile, new Vector3(x, y, 0), Quaternion.identity) as Transform); } } } }