- Home /
OnCollisionEnter2D Problems in Unity 4.5
Hey everyone,
I've been having some pretty severe collision detection problems ever since upgrading to Unity 4.5. To prove my theory I even rolled back Unity to 4.3.4 where my collision detection and functions worked again without flaw. I'm hoping someone may have some insight as to what the problem might be or that there are at least other people experiencing the same problem. Here's a little more detail:
I've created a 2d scene that uses 2d rigid bodies, and 2d colliders. I spawn 2d objects from the top of the scene and the goal is to catch these objects. All of my collision detection is done in my player class's OnCollisionEnter2D function. Basically, if the Collision2D.gameObject.tag is equal to a certain tag, I add/subtract/ do whatever appropriately. This works for some of my game objects but doesn't appear to work with objects that have particle systems attached to them, and eventually when the game gets hectic, very few objects actually register the collision with the player.
Hopefully someone can help me with this problem, otherwise It looks like I will be continuing to use Unity 4.3.4 for the remainder of this project. Thanks for taking a look!
J
I am having a similar problem I have two objects that check for OnCollision2D, as of 4.5 only one of the objects seems to fire this. Is there a reason why? I can't figure it out.
All i was saying is when object A collides with B set object A's parent to B. Doesn't work anymore.
Answer by IgorFira · May 30, 2014 at 02:18 PM
To work around that I'm using the other collider's OnCollisionEnter2D to send a message to the collider.
Your answer
![](https://koobas.hobune.stream/wayback/20220613150220im_/https://answers.unity.com/themes/thub/images/avi.jpg)