Making prefabs for tilemaps

Hello, everyone! I have a tilemap(screenshot below) for my terrain.

I want to randomly build on terrain some “prefabed” constructions, for example just a filled rect of special kind of block, and then palce some gameObjects in there.

What I should to use, to easily make these prefabs and place them on tilemap, using script? I tried to do this only using code, but it will take too much time, to build more prefabs.

Tiles are actually not GameObjects or MonoBehaviours but rather just assets of type TileBase. They actually derive from ScriptableObjects.

You can make these assets on disk, or make them at runtime and modify your TileMap with fresh tiles.

You can also make your own classes derived from TileBase and code up more complicated behavior for a given tile. Check out the docs and maybe look for some tutorials on it.

So, by default, I can’t do anything, to place something on tilemap, and I need to code my own tool to create “prefabs” for tilemap?

1 Like

Hey Danger,
You can use the prefab brush - part of the 2d tile map extras package to achieve what you’re trying to do.

https://docs.unity3d.com/Packages/com.unity.2d.tilemap.extras@1.5/manual/PrefabBrush.html