Hi guys, i have a random dungeon generator that i usually use with 3d prefabs, but now i create some 2D rooms with tilemap and i want to know how can i convert the tilemap into prefabs to use in level generator, because if i simply drag it into Prefabs folder, only appears the single tiles i use and not the entire map.
Hi @Paykoman
Why not convert your tilemap rooms to to a 2D array of ints for example? Then you could feed those to your level generator as rooms data?
you mean you have multiple tilemaps and want to have a single prefab for all of em? In that case why not parent them all to a single gameobject and prefab that then just instantiate the gameobject when needed?
The map generator is ready to simply instantiate random premade rooms, so thats why i want it like that… the other problem is that i need to keep the tile colliders and i don’t think thats possible, cuz if i create a prefab from a level it dont retain the tille collider i have, and creating a new one if dont match the map form…
I dont think im explaining well… i will have 1 tile for example like a 2D square that i paint from it a room with Tile Pallete, as i paint the level it generate the colliders, so that room is ready to play, and i want to create a prefab out of that level with the colliders ready so i can instantiate it, but if i simply drag it into prefab folder the colliders disapear.
So where is the collider you generate? I assumed you were using the tilemap2dcollider that you attach to your tilemap which should follow when prefabed.
I thought the same, but i will test tomorrow again. I have to save the grid main folder as well or i just need to prefab the tilemap?? Appreciate man
You gonna need a grid component if you gonna use tilemaps, so make sure you prefab your tilemaps with a parent that has a grid component, or make em a child to a gameobject with a grid when you instantiate em
I tested out and i probably have to create the collider manually, and them create the prefab, that way the collider stays together. Just need to check the map generator now and see if it works properly like with 3d objects
I work, but the 3d script for random dungeon dont work with 2D assets… -.-"