- Home /
OnCollisionEnter2D only called on first collision?
I added a script to an object with a box collider which has pretty much this
void OnCollisionEnter2D(Collision2D col) { Debug.log(col.gameObject.name); }
And the thing is, that the first time that I hit this object with my player or anything, it gets called and displays the gameObject name on the console, but after I hit it again, nothing happens, it only gets called on the first collision and then never again until I restart the game. Any ideas?
is that the entire script? (oh and use the 101101 tab for your code)
;)
Answer by yusolaifdfer · Mar 26, 2015 at 02:58 PM
Point number 1 : The colliding object must exit the collision object before OnCollisionEnter can be called.
Point number 2 (hopefully this'll solve you) : Check if you have the Collapse turned on in console. Generally when the Log is called from the same line, it increments the number on the right side of the log.