Horje
unity call function on animation end Code Example
unity call function on animation end
// 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
}




Csharp

Related
unity call function on animation finish Code Example unity call function on animation finish Code Example
loop datagridview c# Code Example loop datagridview c# Code Example
unity call function on animation onstateexit Code Example unity call function on animation onstateexit Code Example
c# rsa example Code Example c# rsa example Code Example
function on animation end unity Code Example function on animation end unity Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9