I’m trying to get an animation to play after coming in contact with a collider, but I can’t figure it out, I do have the animator and animation tree all set up.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PunchDummyAnim : MonoBehaviour
{
public GameObject punchDummy;
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Punch")
{
punchDummy.GetComponent<Animator>().Play("Punched");
}
}
}