- Home /
Controller Collider Script
I am making trying to find a script to bring you to a different menu when the first person controller prefab falls into the daylight water. This is how I am using the script:
function OnControllerColliderHit(hit : ControllerColliderHit) { if (hit.gameObject.name == "EndGame Water") { Application.LoadLevel(6); } }
It's not working, help? I added box collider, then trigger, then this script to the water. =[ (6) is what I want it to get to
Answer by andrew · Jul 16, 2010 at 04:18 AM
hi,
The OnControllerColliderHit gets called on the player itself, so the script with that function in it needs to be attached to the player object (with the Character Controller component).
also don't set the collider to be a trigger or the OnControllerColliderHit event wont register. (and finally make sure the game object is named correctly to match the one you are looking for)
hope this helps
Your answer
Follow this Question
Related Questions
OnTriggerEnter() not recognizing collider 1 Answer
Action activates trigger. 1 Answer
Play Sound on trigger 2 Answers
Combining Triggers 1 Answer