Strangest, but also seemingly important error in Unity that I have seen

So I was just adding some simple OnCollisionEnter functions and all was good in MonoDevelop… until I entered Unity. It was there that I encountered quite possibly the strangest errors I have ever seen! Here they are:

Script error: OnCollisionEnter
This message parameter has to be of type:
The message will be ignored.

Script error: OnCollisionExit
This message parameter has to be of type:
The message will be ignored.

That’s right, you’re reading it correctly. According to Unity, my script is incorrect for my “message parameter” has to be of a nonexistent type!

Of course, that means I did something wrong in my scripts, which makes sense because when I enter play mode, my isColliding boolean is not changing upon colliding with the “Chest” object.

Here is my script in question:

public GameObject Chest;
public bool isColliding = false;

void OnCollisionEnter (Collider col){
		if (col.gameObject.CompareTag ("Chest")) {
			isColliding = true;
		}
	}

	void OnCollisionExit (Collider col){
		if (col.gameObject.CompareTag ("Chest")) {
			isColliding = false;
		}
	}

Not sure what’s up with the error message, but the problem is simple if you look at the docs here:

http://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html

Here’s a snippet from the docs:

In contrast to OnTriggerEnter, OnCollisionEnter is passed the Collision class and not a Collider.

So, this:

void OnCollisionEnter (Collider col){

Should be:

void OnCollisionEnter (Collision col){

The same is true of your OnCollisionExit method.

The OnCollisionXXX methods don’t take a “Collider” as parameter but a “Collision”. A Collision contains much more information about the collision than just a Collider such as contact points, collision normal, …