[SOLVED] Destroy(gameObject) happening before physics calculation

In Unity 5.3.4p1, my BlockBreaker ball is destroying the game object before the ball gets a chance to bounce off… this results in the ball going straight through the 1-hit blocks, rather than bouncing before destroying.

I checked out the “Edit-Project Settings - Script Execution Order” that was discussed in an earlier lecture for the paddle and ball, but didn’t see anything that would enable be to control the order of the physics calculation.

Dont know if this would be the best option, but perhaps if you change OnCollisionEnter2D to OnCollisionExit2D, it might fix that issue. If this don’t fix it, I can take a look at that class when I get home

3 Likes

Yes, that was indeed it! I had just come across that answer in the the Udemy Q&A, and was just coming here to post the solution… but you beat me to it!

2 Likes

oh,

I’m glad that it was solved! :slight_smile:

1 Like