- Home /
OnTriggerEnter() not getting called
This is a very strange problem that I've come into. I have a very simple script that is
OnTriggerEnter() { Debug.Log("talking"); yield WaitForSeconds (8); Debug.Log("Finished Talking"); }
When the player object enters a trigger, it doesn't call the function in the script. The object with the script has a collider set to a trigger, and the player object has a collider and a RigidBody.
Thanks for any help!
Is your player object has rigidbody set to kinematic? If yes, then that's your problem since kinematic rigidbodies do not detect collision with static triggers.
Harshad$$anonymous$$, kinematic rigid bodies also work with triggers. Rigid body is the only way to make trigger work, so if you want an object call OnTrigger-events, you should add a rigid body to it, set as kinematic or not.
Oops! $$anonymous$$y bad. :-( Actually got confused with collider and trigger. Had a lot going on in my $$anonymous$$d. Thanks @incorrect for pointing that out. :-)
Answer by tanoshimi · Jun 30, 2014 at 05:19 PM
Your function signature should declare a collider parameter, even if you don't use it i.e.
function OnTriggerEnter (other : Collider) {...
Your answer
Follow this Question
Related Questions
How do I change scene with OnTriggerEnter with thrid person controller? 2 Answers
Check OnTrigger for component 1 Answer
Why isn't my tag working (on trigger enter) 2 Answers
Issues with collision detection 2 Answers
AI Attack Not Working! W/Video 1 Answer