Hi,
I have this problem… where my Player gameObject jump and collision with another collider I see that all script code in the OnCollisionEnter2D func, runs 2 times
How can I disable the event until the first CollisionEnter2D ends ?
Regards
Pablo
Hi,
I have this problem… where my Player gameObject jump and collision with another collider I see that all script code in the OnCollisionEnter2D func, runs 2 times
How can I disable the event until the first CollisionEnter2D ends ?
Regards
Pablo
OnCollisionEnter2D is called when a unique collider/collider pair first contact. You won’t get two from the same collider pair until that pair have received a OnCollisionExit2D.
Also, if you have two Collider2D on the same GameObject you’ll get the callback twice; once for each collider contacting another collider.
It’s all about collider/collider pairs though so anything beyond that needs to be done via your own logic i.e. ignore the callback upon certain conditions.
Thanks, now works fine,
I had the same script attached to the parent gameobject, and one of children GameObject.
You’re very kind.
Regards
Pablo