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
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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash on "The GUID inside 'Assets/asset.png.meta' cannot be extracted by the YAML Parser." when opening the project
- Shadows disappear when looking at a certain angle in Scene view and using Cloud Shadows with Volumetric Clouds
- StackOverflowException freezes or silently crashes the Editor
- Microsoft Surface Device freezes when detaching and reattaching physical keyboard attachment to a Microsoft Surface device in Standalone Player for Windows
- Shadows are cast with artifacts on GameObjects when the light type is set to Point
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!