TileMap Collider 2D generating colliders wrong

Hello,

I’m using Unity 2017.3 beta to play with a 2d project for fun.I’m running into a strange issue that occurs when I attempt to add a TileMap Collider 2D component to a Tilemap.The generated colliders look like they are roughly 10-15x the size of each cell in the TileMap. I have a screenshot of the isolated layer to highlight the issue I’m experiencing.

Other factors to consider in case they help.

Asset Configuration
Tiles are 16x16, sliced from an imported asset with the following settings (only showing what I’ve changed for brevity):

Pixels Per Unit: 16
Sprite Mode: Multiple
Wrap Mode: Clamp
Filter Mode: Point

Within the sprite editor, I’ve changed the slice settings from Automatic to Manual with a Pixel Size setting of 16x16.

TileMap Configuration

I am using three TileMaps and setting them with a layer order of 0, 1, and 2.
TileMap’s are all set with a shader of Sprites/Diffuse to support point lighting.

Repro Steps

  1. Create a new 2D project
  2. Import an asset to use for tiles. I’ve used 16x16 tiles. Import settings should be modified according to my above configuration.
  3. Use the sprite editor to slice the sprites according to my above configuration.
  4. Create a TileMap in the scene and create a new TileMap palette with the sliced tiles.
  5. Paint a basic map using the brush.
  6. Select the TileMap from the scene use the “Add Component” to add a TileMap Collider 2D.

At this point I feel like I’ve missed something very basic, like a simple checkbox or a setting.

Gah! After messing with settings for hours and hours, I found the issue in an anecdote in another thread. Once I went to my asset, then into the sprite editor, and updated the physics shape, the colliders started generated correctly. I hope this helps someone else.

7 Likes

I’m not getting. What exactly did you do?

1 Like

He went into the Sprite Editor (select your raw image in the project panel, and click the Sprite Editor button in the Inspector), and at the top left, you can click Sprite Editor and change it to “Edit Physics Shape” which will let you modify the shape the physics system uses for the Sprite(s).

1 Like

Yes! it work! thanks @zoeysaurusrex
I thought this was a bug since I never encounter in 2017.2, I don’t even notice Sprite Editor has Physics Shape beforehand lol

4 Likes

Rosa-Gao! u a genius, i was getting frustrated, thank you

Thank you so much. This helped me a lot :smile:

Thanks!

Please use the Like button to show appreciation rather than necroing very old threads.

Thanks.

1 Like