Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2018.4.21f1
2019.4
2020.1
2020.2
Issue ID
1255872
Regression
No
OnTriggerEnter2D is not called when entering Tilemap collider from specific side
How to reproduce:
1. Open attached project "TilemapOnTriggerEnter.zip" and scene "Main"
2. Enter Play mode
3. Observe the moving object
Expected result: the object flips when left wall is touched
Actual result: the moving object goes inside the left wall
Reproducible with: 2018.4.24f1, 2019.4.1f1, 2020.1.0b13, 2020.2.0a15
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
- Mouse input is registered incorrectly in Custom RP when downscaling Render Target and rendering Overlay UI before final upscale
- Time.deltaTime is locked to the display's refresh rate when the built Player is moved to a Secondary Display and Windowed Mode is used
- Crash on RaiseException when importing a specific asset
- Crash on RaiseException when opening a specific project
- DownloadHandlerScript.CompleteContent is called twice when building for WebGL
Resolution Note:
Based on the given project, it seems that everything works correctly according to the given specifications (Collider placement, user script).
OnTriggerEnter2D is called once as the BoxCollider2D it is using contacts the Foreground TilemapCollider2D at the start of the scene, as the BoxCollider2D is placed between the Foreground and the Enemy object. As the BoxCollider2D remains in contact throughout, OnTriggerEnter2D will not be called again. This allows the Enemy object to continue walking through the TilemapCollider2D as the BoxCollider2D is set to IsTrigger.
A different setup may be required to get the behaviour that the user is expecting (eg. shifting the BoxCollider2D higher up so that it does not contact the ground portion of the Foreground TIlemapCollider2D).