3D tile on Tilemap does not take into account GameObject rotation

Hi,

Note: this is about GameObject (3D) tiles, not about Sprite (2D) tiles.

It seems that the GameObject rotation of tiles set with Tilemap.SetTile() (or painted with the GameObject Brush in the editor) is not taken into account. Whatever the value of the rotation is in the prefab, it is always 0 once the tile has been added.

Steps to reproduce:

  • Create a new 3D URP Core project (I’m using Unity 2021.3.21f1)
  • Add 2D Tilemap Editor (v1.0.0) and 2D Tilemap Extras (v2.2.5) packages to project
  • Create a 2D Object > Tilemap > Rectangular
  • Change Grid orientation to XZY
  • Change Tilemap orientation to XZ
  • Create 3D Object > Quad and name it “Tile”
  • Set rotation of the Quad to 90;0;0 in the Inspector so it is flat on the Tilemap
  • Make a prefab with the Quad
  • Remove the Quad from the Scene
  • Go to Window > 2D > Tile Palette
  • Create a new Tile Palette
  • Select “GameObject Brush instead of “Default Brush
  • Click on “Cells to unfold the UI
  • Click on “Element 0 to unfold the UI
  • Drag & Drop the Quad prefab named “Tile” created earlier in the “Game Object” input
  • Click on “Paint with active brush (B) at the top of the Tile Palette window
  • Click on a few cells on the Tilemap
  • Observe the Quad rotation is lost, it is not flat but it’s “standing up” with a rotation of 0;0;0

Is anyone aware of this behaviour?

1 Like

The Offset, Scale and Orientation settings in the GameObject Brush will take precedence over the values set in the Prefab for this particular case.

If you set the Orientation in the GameObject Brush as shown below, the Quad will be painted as expected:

Hi, thank you for your answer @ChuanXin . However, how to achieve this using SetTile() or any programmatic way?

Right now, you would have to create a custom Tile script and override the StartUp method to set the rotation and scale.

We will try and make this simpler so that you do not need to do this, and the creation of the GameObject in SetTile would use the rotation and scale directly instead (The position will still be set based on the Tile’s position).