Physics seems to work differently since 5.3.5 update

Hi,

I have a project with a 2D character collecting bouncing coins I developed on Unity 5.3.4f.

The coins have a Circle 2D Collider and the character a Polygon Collider 2D and a script with this code :

void OnCollisionEnter2D(Collision2D collision){

switch (collision.gameObject.tag)

{

case "hazard":

scoreMinusOne ();

Destroy (collision.gameObject);


break;


case "coin":

scorePlusOne ();

Destroy(collision.gameObject);

break;


default:

print ("Incorrect tag");

break;

}

}

The code destroy coins when they collide with the character. Since I update to Unity 5.3.5f, the character bounces against coins before they get deleted. It seems like the Physics calculation and the OnCollisionEnter2D code are played in a different order in this version.

Any thoughts ?

Thanks, it’s better now !

If the player isn’t meant to interact with the coins as if they were physical objects then it’d be better to make the collider a trigger and use OnTriggerEnter2D Unity - Scripting API: Collider2D.OnTriggerEnter2D(Collider2D)