Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

function on animation end unity

// 1. click on the animation state block in the animator and in the inspector
// 2. click Add Behavior button and edit that new script
// 3. find the OnStateExit function and un-comment it. Example below.

// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
  GameObject self = animator.gameObject; //a reference to the gameobject being animated
  MyScript script = self.GetComponent<MyScript>();
  Debug.Log("Animation has finished!");
  script.SendMessage("MyFunction"); //this is the name of the function to call
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: initialize list in c# 
Csharp :: hello world in unity c# 
Csharp :: c# new object without class 
Csharp :: wpf app how to get all elements which are exposed to script 
Csharp :: what is the meaning of ?? in c# 
Csharp :: binary search c# 
Csharp :: unity gameobject.find 
Csharp :: coroutine start unity 
Csharp :: ef core set identity_insert off 
Csharp :: particle system start color 
Csharp :: get text unity 
Csharp :: raylib c# basic window 
Csharp :: join two array c# 
Csharp :: dictionary order by value c# 
Csharp :: Squares of a Sorted Array 
Csharp :: multithreading in c# 
Csharp :: read file using c# 
Csharp :: c# get foreground window 
Csharp :: lcm of numbers 
Csharp :: how to deactivate an object unity 
Csharp :: how to check type c# 
Csharp :: constructor c# 
Csharp :: an existing connection was forcibly closed by the remote host. .net core 
Csharp :: mongodb driver c# nuget 
Csharp :: how do you make a 2D object follow another 2D object in unity 2D 
Csharp :: null check syntax c# 
Csharp :: c# datetime blank 
Csharp :: Get the Photon Player GameObject 
Csharp :: c# code skripte kommunizieren 
Csharp :: the same schemaid is already used for type swagger 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =