onControllerColliderHit does not seem to work...

I am reading the book about unity3d from Will Goldstone. Currently i’m in chapter 4 were we have to check if our character collides with another object.
Therefore we use the onControllerColliderHit function however it does not seem to trigger on me…

THis is the script:

function onControllerColliderHit(hit: ControllerColliderHit)
{
    print("Collide");
	if(hit.gameObject.tag == "outpostDoor"  doorIsOpen == false)
	{
		currentDoor = hit.gameObject;
		Door(doorOpenSound,true,"dooropen",currentDoor);
	}
}

That print never shows… When i’m colliding with the door, my char stops so i guess the engine realy detects that i’m hitting the collider of the object.

My script is on a gameObject with a FPSWalker script and a Character Controller on it.

Anybody knows what i could have been doing wrong?

mmm found it :slight_smile:
On instead of on in my function name.
So easily overlooked…

is the standard for javascript and other languages not to start with a lowercase in the functionanme? uppercase is for classes and so. I have written thousands of lines of javascript as a webdeveloper so it was a habbit when using on with a lowercase…

Starting function names with an uppercase letter is a .NET thing - it isn’t common elsewhere.