When importing Tiles into the Tile Palette in Unity, you may sometimes run into an issue where your Tiles are not aligned with the grids in the Tile Palette, which will subsequently lead to the Tiles being off-alignment with the grid in your Scene too.
The fixes to this are quite simple. Fix #1 is a fix that you will find posted in most forums and Stack Overflow topics, but Fix #2 is relatively obscure. Let’s have a look at them:
Fix #1: Centering the pivot for your sprites
An off-alignment Tile in your Tile Palette may be caused by misplaced pivots in your Tile sprites. In such a case, you will have to find the affected sprite(s) or sprite sheet(s) in the Project window, and edit it in the Sprite Editor.
What you want to do in the Sprite Editor is set the pivot of your affected sprite(s) to the centre:
Article continues after the advertisement:
If you have a sprite sheet with a lot of sprites, it may be more efficient to just re-slice the sprite sheet. Remember to set the pivot for the sliced sprites to Center before you slice!
Once you centre the pivot for your sprites, your Tiles should no longer be misaligned — both in the Tile Palette and in the Scene.
Fix #2: Removing the Tiles’ positional offset
If your Tiles are still off-centre after the pivot is set, then it is likely that they contain a positional offset value. Notice, in the animated GIF below, that selecting a Tile on the Tile Palette will reveal the properties of the Tile on the Inspector window.
To fix the off-centre Tiles, you will have to select all of your affected Tiles in the Tile Palette, and then change their positional offset altogether in the Inspector.
Once that is done, you might notice that while the Tiles in the Tile Palette are fixed, the Tiles that are already painted onto your Scene might still be misaligned. To fix this, you only need to paint over the old, off-alignment Tiles that are in the Scene with your newly-aligned Tiles in the Tile Palette.
Video guide
Prefer to watch instead of read? You can use our video guide for this fix instead:
Conclusion
Find any other solution to this issue that we haven’t listed in the guides? Let us know in the comments below, and we will update this article to reflect it.
Article continues after the advertisement:
Thanks, that worked.