OnCollisionEnter says message parameter has to be :

Script error: OnCollisionEnter2D

This message parameter has to be of type:

The message will be ignored.

File name:BallControl.cs

Why nothing behind “:”? How can I fix it? Can someone help?
Thanks : )

1 Answer

1

Ready this link for use of collisionenter2d.

void OnCollisionEnter2D(Collider2D obj) { Debug.Log(obj.gameObject.name); } I wrote this, but it couldn't work. void OnCollisionEnter2D(Collision2D coll) { Debug.Log(coll.gameObject.name); } Then I copied this from other's blog and deleted what I wrote before, it could work! Then I delete all of them and wrote the same code as what I copied before, strangely it still couldn't work. I can't understand why! Can you help me? Thanks a lot:)