OnCollisionEnter() not working in Unity3D
c#, unity-game-engine
Solution
I had the same problem of `OnCollisionEnter` not being called and found this question.
For me, the problem was that I was making a 2D game so the answer is to use the `OnCollisionEnter2D` function instead.
Problem
I have an object with a mesh collider and a prefab with sphere collider. I want the instance of the prefab to be destroyed if the two collide. I wrote the following in a script: ``` private void OnCollisionEnter(Collision c) { if (c == target) Destroy(transform.gameObject); print("something"); // Doesn't get printed } ``` But it is not working. I have tried toggling `isTrigger` on both the objects.