- Home /
What is the best way to create 3D tile based levels in Unity ?
I have created individual tiles of 1 x 1 in Unity of different kind of tiles that I require in my game, for example a tile for grass, a tile for a concrete road, a tile for a tree, a tile for a pool of water, etc. What is the best way to go about creating a level that is more intuitive than manually placing each and every tile in 3d space in Unity.
Kindly check the attached images to get a better idea of the kind of levels I'm trying to create. It would be great if you could provide pointers to achieve something like this.
What do you want, exactly?
Some kind of algorithm to automatically generate level maps?
That's possible, but not exactly easy...and I have no idea how it's generally done. $$anonymous$$aybe look up some map creation algorithms and work from there? Just googling 'map creation algorithm' gave me some promising results.
Thanks for the reply. I'm looking for something along the lines of ProTile $$anonymous$$ap Creator. Something that lets you click and drag a specific selected tile and drop it into 3d space.
Ah. Well, why not buy that asset then?
Or you could try to write something similar yourself I suppose, I've never written an editor extension but it doesn't look that complicated.
Depending on which of those 2 options you want I think you should change the phrasing of your question a bit to either something like "What is a good plugin/extension for creating tile maps" or something related to a specific issue you run into if you try to write it yourself.
Answer by KubaPrusak · May 30, 2015 at 03:15 PM
You can create a 2d array that will hold a number. Then you go through the array and depending on the number it has you instantiate a different tile prefab with the 2d array coordinates for example
tiles[5,7] = 3, this would create a grass tile at world coordinates 5,0,7
You could load the numbers from a text file and easily modify that.
The other option is to look into Editor Scripts, I dont know much about them but you could create a script in which you have a window with all of your tiles and you can click a tile and then click where you want that tile to go. The script would then place the tile to the nearest whole number.
Here is an example of an editor script http://forum.unity3d.com/threads/here-is-an-editor-script-to-help-place-objects-on-ground.38186/
Your answer
Follow this Question
Related Questions
3D level generator on a grid C# 1 Answer
UI scrollable rect, get position on content based on mousePos. 0 Answers
Grid Movement VS Free Movement 1 Answer
2D Tile Map Question 0 Answers
Generating and altering a mesh at runtime as a grid based terrain 3 Answers