- Home /
Question by
DevoidSimo · May 08, 2013 at 01:32 AM ·
not workingoncontrollercolliderhit
Problem with OnControllerColliderHit
I have a script attached to a first person controller which contains the following function:
function OnControllerColliderHit (hit : ControllerColliderHit) {
if (hit.gameObject.tag == "Finish"){
print("hit");
}
}
I have objects in my scene which I'm testing this in tagged as Finish however when I run into them hit does not appear in the console, if it helps at all these objects are moving and don't have a rigidbody attached. Also the controller does get pushed by these objects so they are registering the collision. Without the if statement hit is returned every frame as the controller collides with the terrain. Thanks in advance
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613101813im_/https://answers.unity.com/themes/thub/images/avi.jpg)