linjie
0
Q:

how to play animation with code in unity

animator.Play("StateName");
3
public GameObject ExampleNPC;

void Update()
{
    if(Input.GetButtonDown("Animation")) // Make sure to refrence this in Input settings
    {
        ExampleNPC.GetComponent<Animator>().Play("Anim name");
    }
}
0

New to Communities?

Join the community