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
- Character spacing value is not applied when using a specific font asset
- [Android][IL2CPP] Player crashes on __memcpy_aarch64_simd+276 when invoking native code via a plugin on some ARM64 Android devices
- [Android]Resources fail to load when the AAB build contains a large Addressables Bundle
- Unity is loading internal version of SharpZipLib instead of local version
- The Context Menu items are ordered incorrectly
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).