1
\$\begingroup\$

What am I missing here? Is Unity's tilemap limited to size 32x32?

I am trying to understand why my sprites in my Unity tilemap are spaced apart from one another such that if I paint them into the scene the tiles are centered in the grid's cells in an undesirable way.

I want my grid to be size 8x8 pixels and I want my sprite sheet to be imported in with pixels per unit set to 32 so that it matches the pixel size of my character and the rest of my art.

I've tried adjusting the import size setting and that did nothing. I've tried changing the scaling of the grid, but that results in a smaller grid with smaller sprites still centered in the cells.

The only thing I've found that "fixes" this is to re-slice my sprite sheet at 32x32, but that results in tiles that are larger than what I am aiming for. enter image description here

enter image description here enter image description here

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I am not sure why the padding in those cells appears, but I found the necessary steps to achieve the results I wanted. Evidently the default size of the tilemap is based on a size of 32 pixels.

Steps to setting up your tilemap.

1) import the sprite sheet using the same pixels per unit that you intend on using when slicing your sprite sheet. For me, I import in at size 8 and sliced at size 8.

2) create your tilemap pallete using that same size again or "automatic" sizing. For me, size 8.

3) drag your sliced sheet into your newly created pallete so that the tiles are created.

4) The default size of the Unity tilemap is 32 pixels by 32 pixels. I never set this, so I am assuming that it the default size. Since that is the default size, scale your tilegrid gameobject by a ratio equal to your desired size / 32. For me, that meant scaling to 0.25 using the Transform.

5) your tile sizes should now fit the cell size and the pixel size should be correct.

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I just leave tile pallet to size to automatic and then set the sprite pixel unit to the size of the actual tile. I think you're over complicating this? \$\endgroup\$
    – Sidar
    Commented Aug 7, 2018 at 18:31
  • \$\begingroup\$ Possibly, but the reason I over-complicated it was because I realized that the tiles for the ground and map work better when they are smaller than character sprite. And in my case, I'm adding onto an older project. All my art was sized as 32x32. As soon as I decided to slice my sheet at a smaller size, I ran into trouble. \$\endgroup\$ Commented Aug 7, 2018 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .