Play animation on collison

Hello!

I have tried this but it doesn’t work

using UnityEngine;
public class PlayAnimOnTrigger : MonoBehaviour {

    public Animator anim;
    public AudioClip sound;

void Start () {
        anim.enabled = false;
}

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == ("Player"))
        {
            anim.enabled = true;
            AudioSource.PlayClipAtPoint(sound, transform.position);
        }
    }
}

Please use code tags for posting code on the forum:

What does exactly mean “it doesn’t work”? What is the effect?

He should play the animation and a sound on collision.

Have you tried to put Debug.Log inside the if to see if your code even gets there?
Do you put this script on the “enemy” (or whatever you collide with?)
Does the “mute audio” button active on the game view window?