Fixing off-centre Tiles in the Unity Tile Palette

Fixing an off-centre Tile Palette in Unity

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.

Unity's Tile Palette off-centre
The Tiles are off-alignment in the Tile Palette, causing the same to happen in the Scene.

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:

Centering a Sprite's pivot
These are not Tile sprites, but you get the idea.
Sprite sheet from unity-chan.com.

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!

Re-slicing the Sprite
Remember to set the Pivot to Center before slicing.
Tiles from Kenney.nl.

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.

Positional offset data in Unity's Tiles
Pictured: Where to find the positional offset of a Tile.

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.

Modifying the positional offset of a group of Tiles
Pictured: How to modify the positional offset of a group of Tiles.

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:


There are 1 comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.