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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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).