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;
}
}