- Home /
OnColliderEnter2D not working
Hi, I have a problem with OnCollisionEnter2D, the function is never called, despite the objects all have boxCollider2D and rigidbody2D, I also checked that the kinematic type was disabled. Where else am I wrong? I trust in your help
The most probable issue is how you move your objects. can you add your code regarding this to your question? also do you have any layers set? did you change the collision matrix?
Where else are you wrong? Idk I can't see your code.
Can you send your code? It's almost impossible to help if you don't. It's just good practice. I have my suspicions, but I can't know anything until I see your code.
Answer by Coleclaw199 · Oct 12, 2021 at 07:52 PM
Since you barely provided any information, I'll put a few possibilities in here. 1. One of your objects isn't marked as trigger. 2. You aren't using Collision2D as the argument. 3. Which are you using? OnColliderEnter2D or OnCollisionEnter2D? You listed both of them. The correct one is OnCollisionEnter2D.
If any of these helped, please mark this answer as the correct one.
I will also request that you add a little more information when asking a question next time, however.
Answer by jiri-vyc · Oct 12, 2021 at 08:24 PM
On top of @Coleclaw199 's answer, also check whether you should really use OnCollisionEnter2D or OnTriggerEnter2D (if your colliders have "IsTrigger" set to true)
Your answer
Follow this Question
Related Questions
Strange Collisions (...as there should be none!) 0 Answers
How to detect which side of my player has collided? 2 Answers
OnParticleCollision Question (Image included) Particle Decal Hanging off Edge 1 Answer
How to check if two objects collide without a collider 1 Answer
collisions will sometimes be detected and sometimes will not 1 Answer