Question by
akashif · Apr 28, 2017 at 06:06 PM ·
collision detectioncollider2dcollision2d
OnCollisionEnter2D is not being called
HI, I am working on a ball based game, and need to destroy the ball on Collision with other ball.
Ball 1 = RED_BALL
Ball 2 = spikedball
Both balls have "Circle Collider 2d " attached.
spikedball has a script attached which contains following code.
private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("OnCollisionEnter2D is called");
Destroy(collision.gameObject);
}
Problem is the event "OnCollisionEnter2D" is not being fired at all.
Additional information:
Using Unity5.5.2f
Both balls are on same sorting layer
Attaching Inspector image on both balls.
Please advise what wrong i am doing. o
Thanks Ali
red-ball.png
(20.8 kB)
spikedball.png
(24.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Physics 2D with tile collider corner problem 2 Answers
OnCollisionExit2D strange behaviour 0 Answers
How to check if any/multiple 2D sprites neighbour/collide with eachother 0 Answers
Collision not working 1 Answer
Enemy 2D check for collision 1 Answer