Kartik
Kartik

Reputation: 104

OnCollisionEnter not firing in Unity3D

I know this has been asked many times but I have checked as many forums as I can. Here is everything I'm doing:

I have a cube (that in this case is serving as the floor) with the following properties

Cube Properties

and I have a "Runner" that is just a cube with the following properties

Runner Properties

I froze the z position and rotations because this is a side-scroller.

The onCollisionEnter method for the "Runner" that you can see is attached to the "Runner" object is as follows:

    void onCollisionEnter(){
    print("Collision Detected");
}

And when I run it, I get bupkis. So. Help please? It seems so simple but I am clearly messing something up.

Upvotes: 0

Views: 2085

Answers (1)

Bart
Bart

Reputation: 20030

It is not

void onCollisionEnter()

but as stated in the documentation

void OnCollisionEnter(Collision collision)

So the method is written in full CamelCase and has an argument.

Upvotes: 1

Related Questions