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
- [Android] Stage information is not logged when Log Shader Compilation is enabled
- [Vulkan] The memory allocation increases rapidly when there are multiple (three or more) Real-Time Reflection Probes in the Scene
- [macOS] Library folder of the opened project can be deleted which leads to the crash
- “Default Scene” dropdown field contains a spelling mistake “Default Builtin”
- Editor crashes on PPtr<Mesh> after adding Text Mesh and Cloth Components to the same GameObject
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).