Best way to draw trees in Unity's Tilemaps?

Hello! Excuse me if this posted somewhere but I’ve been struggling to find an answer for the last couple of days.

I’m working with Unity’s Tilemap system, and trying to build a top down 2d level. (something like legend of zelda) I have currently a grid with two tilemaps in it. One for the ground and one for colliders. I want to draw a tree into my level, (a tree that is apart of my tilemap sprite, and something that could potentially take up to 3x3 tiles, for example) where the base of the tree has collision and the top part of the tree does not, but I’m struggling to find the best way to do this.

I have some potential solutions:

  • Avoid the use of tilemaps for the tree and just create and drag and drop a prefab in. Although I’d love to be able to just paint my trees into the level instead of using drag and drop. And creating a prefab for every object feels much slower than just using the tilemap.

  • Use the GameObject (or is it Prefab?) brush, but I don’t really understand how to make this faster. You have to drag the gameobject into the brush info to change what your drawing? And it still requires the creation of prefabs.

  • Same as 2, but also create Rule Tiles for every prefab I make, assign the rule tile’s GameObject as the prefab, and put that into the Tilemap. This actually seems like one of the best ways, however it requires creation of a rule tile for every prefab I want to draw. Also it draws weirdly when its in the editor. The top of the tree appears underneath trees higher up.

  • Create a third tilemap that lacks collision and has a higher sorting layer than the player, draw the base of the tree into the collision tilmap, and the rest of it in the new tilemap. However this solution is just awkward and confusing.

Is there anything better than one of these solutions? Or perhaps a better way to utilize them?

I come from an RPG Maker background where the tilemaps were super easy to use and configure, but maybe that power doesn’t exist here in Unity yet.

i get what you are saying, rpg maker has a really good tilemap system

you will break your head in unity just to try and replicate what was automatic in rpg maker

unity is first of all a 3d engine and the 2d features are still coming along. With some work you can of course create a system that surpasses the rpg maker system easily.

with that said, dont break your head over it, you should go for option 1

You could create a custom Brush to help you paint onto two tilemaps at once.

Here are examples of how to make a custom brush: 2d-extras/Editor/Brushes at master · Unity-Technologies/2d-extras · GitHub

You could then have that brush take not a Tile but a “MultiTile” asset.

public class MultiTile : ScriptableObject
{
   public TileBase baseTile;
   public TileBase topTile;
   // perhaps has the string name of the tilemap to search for base and top
}

For >1x1 tiles, you could use arrays.

Assuming that your trees are not tied to a particular Tile, you could use this.

If you use the GameObject brush, you could use the Paint tool to “paint” your GameObject onto the Tile Palette and in the future, use the Pick tool and pick the GameObject from the Tile Palette for “painting”. The GameObject Brush would create a Prefab instance if the original GameObject is a Prefab, or would other clone the GameObject.

Thanks everyone for the replies and information, I’m picking up that I should stick to unity’s prefab system and learn to use that as best as possible, possibly with or without the brushes.

Curious, is there a good way to construct my tree prefab from the 9 tiles (3x3) that I’ve already imported via my tilemap? Like is it performant to have prefabs with Grids and Tilemaps inside them? (Or use 9 different spriterenderers) Or should I reimport the tilemap and select the sprite in its entirety?

its better to just have a full sprite