1
\$\begingroup\$

I'm trying to create a hybrid system for my Unity game. I want to use tilemap for collision and use sprites for the world.

I drew a sprite onto a 40x40 checkerboard grid as can be seen here. I wanted an easy way to create a collider for this without spending 30+ minutes hand placing box colliders and I decided to use a tilemap to place red tiles and use a tilemap collider for collision geometry and just hide the red tiles in-game.

Issue is, I have no clue how to align the checkerboard with the Unity tilemap grid.

Here's a screenshot of the sprite in the unity editor with the tilemap grid visible.

If it isn't obvious, then the white lines is the grid for the tilemaps. The cellsize for each cell on the grid isn't the same size as the cells on the checkerboard pattern and I have no idea how to fix it.

The PPU (pixels per unit) of the sprite is 140. The PPU for the tileset tile(singular since there is literally only 1 tile in the entire tileset) is also 140. The checkerboard in paint.net is 40x40 and so is the tile. How can I get the cellsize of the grid in unity to match the cell size of the checkerboard.

\$\endgroup\$
  • \$\begingroup\$ If your checker squares are 40 pixels, is it safe to assume you tried a PPU of 40? \$\endgroup\$ – DMGregory May 6 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.