While playing with the Unity engine I tried to add a basic collision detection in my game. I've created two simple objects which both move in a different directions, towards each other (so they collide). In the OnCollisionEnter2D(Collision2D col) method I placed a Debug.Log() to test if the collision works.
I followed the tutorials from the official Unity channel and followed the exact steps as provided. But it still doesn't work! I read almost every post on Google with the same problem, but still didn't find any solution
What did I try?
- The Z-position is for both objects set to 0.
- Both objects have a RigidBody2D and a BoxCollider2D
- Objects aren't moving too quickly, they move very slow (for testing) (I've read that if they move so fast that they pass through each other between frames the collision won't be detected)
- Two trigger colliders cannot collide - one must be a regular collider (applied this)
- The objects are on the same layer and I checked the 2D physics settings and ensured that all layers can interact with each other.
- All my colliders and RigidBodies are the 2D variant (this is the solution I've read the most on the internet, but didnt fixed it for me!)
Here are two screenshots of the Gameobjects I would like to collide. (Sorry cant post images, because I got too low reputation)