- Home /
Add tiles with script
So, this feels like it should be a piece of cake, but I just cannot find how to do it...
My end goal is to make a procedurally generated map, sort of like Sebastian Lague's https://youtube.com/playlist?list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3, but 2D, and most importantly, with tiles (preferably isometric, but I can probably figure that part out myself). (The ultimate end goal is to achieve a world generation akin to that of Age of Empires, or Life is Feudal: Forest Village)
So, in order to procedurally generate these tiles, I must add tiles to a tilemap through a script (which will also hold the noise values, etc.), correct? Yet I cannot find the function for how to simply "add tiles at coordinate" to a tilemap, nor how to set it up and connect the necessary parts.
So to put it simply, how do I use a script to add a tile to a tilemap?
Answer by MUG806 · Feb 15, 2021 at 09:36 PM
lmgtfy
https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.SetTile.html https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.SetTiles.html https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.SetTilesBlock.html
and many more
https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.html