Search
 
SCRIPT & CODE EXAMPLE
 

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");
    }
}
Comment

play animation through script unity

animator.Play("StateName");
Comment

PREVIOUS NEXT
Code Example
Csharp :: C# get string as stream 
Csharp :: get name of project c# .net 
Csharp :: define a vector c# 
Csharp :: c# float to string with 2 decimals 
Csharp :: insert new item listview c# 
Csharp :: c# how to terminate console application 
Csharp :: c# datetime to timestamp 
Csharp :: mathf.clamp unity 
Csharp :: how to make a enum list in c# 
Csharp :: c# for loop increment by 2 
Csharp :: c# string array initialization 
Csharp :: c# send email 
Csharp :: get input c# 
Csharp :: .net core check if user is logged in 
Csharp :: get folders in directory c# 
Csharp :: C# .net core convert string to enum 
Csharp :: convert generic to type c# 
Csharp :: if unity 
Csharp :: convert string to int and read it 
Csharp :: c# listbox delete selected items 
Csharp :: mute sound unity 
Csharp :: C# get key by value Dict 
Csharp ::  
Csharp :: asp.net core 3.1 ajax partial view 
Csharp :: unity how to get a child from a gameobject 
Csharp :: c# print console 
Csharp ::  
Csharp :: unity instantiate prefab rotation 
Csharp :: c# enum to int array 
Csharp :: unity raycast 2d 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =