[2d Tilemap] Tile's "Game Object to Instantiate" doesn't rotate with Tilemap orientation

Needless to day I’m using:
2D Tilemap Editor
2D Tilemap Extras

Unity 6
I’m in a 3d project.

I’m trying achieve a simple-enough grid system using the 2d Tilemap. Before I go on building custom code to instantiate objects I want to be sure it’s a bug with the tilemap system.

As the title states, as I create a new Tile, I’m adding a prefab in the “Game Object to Instantiate”.
As I paint my tilemap, it does instantiates the 3d object, but it doesn’t follow the tilemap orientation.

Repro steps:
Install the packages.

  1. Create a Tile and assign a (non-perfectly-symmetric) prefab.
  2. Create a new Grid
    2.1 In Grid: set swizzle to YXZ (this will change the 2d coordinates to align with the floor plane of a 3d world)
    2.2 In Tilemap: set orientation to XZ ( this rotates the individual Tiles inside the Tilemap to be flat with the ground that was setup in the Grid )
  3. Now paint the tile in. You’ll see the tile is properly painted but the 3d object is flipped…

My suspicion is that the orientation, which flip the individual tiles, is not applied to the new instantiated gameobject
I’m trying to set up a somewhat medium scale project having to create all the prefabs with the rotation flipped to fix the non-rotating instance is not really in my plans…

look with me at this sad sideways house :frowning:

Ok I’m not crazy, this is just an old problem…
For now I have a script instantiating objects instead of using Unity, seems like such a trivial problem compared to the miracles this app can pull off, I wonder why it still like this

Ops sorry, almost forgot to post the answer, this will rotate the object into place:

// You're probably already extending Tile, but if you need to make it appear in the creation menu as is:
// [CreateAssetMenu(menuName = "2D/Tiles/FixedTile")]

public class FixedTile : Tile
{
    // Fix your rotation here, I think in most cases using 270 will fix the issue, unless you're doing a weird setup side-ways inverted? Yeah this could get the grid and rotate based on swizzle, feel free make it fancy:
    private Vector3 rotationEuler = new Vector3(270f, 0, 0);

    public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
    {
        if (go != null)
        {
            go.transform.Rotate(rotationEuler);
        }

        return base.StartUp(position, tilemap, go);
    }
}

1 Like