Unity3D – External Map Editor – Text Based

The biggest downside to Unity3D so far for me has been the lack of mod support for your projects. I wouldn’t have jumped into this game if it wasn’t for Doom WAD and Quake C modding when I was younger. I spent some time today and wrote a script that will read a text file of a specific name and then generate a tiled map based on the strings in the file. This one only supports 2 types of tiles but you can add as many as you want by adding new if/switch statements in the BuildMap() function. This script will read the text file line by line from top to bottom, fill a 2D array with the parsed text data (as INT), then instantiate the GameObjects you have assigned. There was some trickery to get the tiles to line up correctly as you’ll see in the BuildMap() function. This is due to lack of knowledge I have on flipping arrays and/or reading text files top to bottom. You could easily take this to another extreme and build a map editor either in your game or an external one for your players to use. Enjoy!