Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to play animation with code in unity

public GameObject ExampleNPC;

void Update()
{
    if(Input.GetButtonDown("Animation")) // Make sure to refrence this in Input settings
    {
        ExampleNPC.GetComponent<Animator>().Play("Anim name");
    }
}
 
PREVIOUS NEXT
Tagged: #play #animation #code #unity
ADD COMMENT
Topic
Name
3+2 =