Animation Won't play OnTriggerEnter

hi all .

I added this script to an Game object :

 var clip : AnimationClip;
    
    function Start () {
    
    }
    
    function OnTriggerEnter () {
    
    animation.Play(clip.name);
    
    }

then i selected my animation beneath the script in the inspector. but when i reach the object nothing happens and the selected animation won’t play .

Put a Debug.Log() inside of the OnTriggerEnter(). This will tell you whether the problem is with the Trigger or the animation. Lost of posts on why Triggers don't fire. And only post once please.

1 Answer

1

First, you need to have something in your function. Ex: function OnTriggerEnter(other : collider)

Second, do you have your objects collider set to IsTrigger?

Thank you . yes that was my problem ... i didn't add a collider on my object !