Search Issue Tracker

By Design

Votes

0

Found in

2017.4.0f1

2018.4.0f1

2019.2.0a1

2019.2.5f1

2019.3.0a1

2020.1.0a1

Issue ID

1189107

Regression

No

Tilemap Collider 2D does not detect certain Tiles when their Collider Type is set to Sprite

2D

-

Reproduction steps:
1. Open the attached project named Case_1189107
2. Open the "Test" Scene and observe that the Tilemap in the Scene has a Tilemap Collider 2D component
3. Open the Tile palette window and select glass_window palette
4. Draw a few tiles in the Scene
5. Select the Tilemap object in the Scene to inspect the collider

Expected result: All the drawn tiles have a collider
Actual result: None of the drawn tiles have a collider

Reproducible with: 2017.4.33f1, 2018.4.11f1, 2019.2.9f1, 2019.3.0b6, 2020.1.0a8

Notes:
Changing the Tile's collider type to "Grid" seems to resolve the issue

  1. Resolution Note:

    The glass_window Texture that you are using has alpha values set into them. This prevents Unity from generating an outline for your Sprites for a physics shape as there is an alpha threshold that is set when generating such outlines to create a tightly bound physics shape. For this case, the alpha values are below the threshold set, which result in no physics shape being detected. Right now, the alpha threshold cannot be adjusted and we will evaluate whether this will be exposed as a feature in the future.

    In the meantime, if setting the Collider Type to Grid for your Tiles works for you, please do use that.

    If you need a particular physics shapes for your tiles, you can do the following to create a custom physics shape for your tiles:

    -In the Project window, select the Texture asset for your Sprites.
    -In the Inspector window, select the Sprite Editor button.
    -In the Sprite Editor Window, select Custom Physics Shape from the Modules dropdown from the top-left.
    -Select the Sprite which you want to create a custom physics shape for.
    -Set your own custom physics shape using the Editor. To start off, you can click and drag on the Sprite to create a box which you can begin editing with.
    -Remember to click Apply at the top-right after you are done!

    Manual: https://docs.unity3d.com/Manual/CustomPhysicsShape.html

    Hope this helps!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.