unity animation set parameter
//click the add behaviour button on a state in the animator controller
//and add a script. Just put the name of the bool in the inspector
public class AnimatorResetBoolAtEnd : StateMachineBehaviour {
[SerializeField]
private string booleanVariableName;
// 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)
{
animator.SetBool(booleanVariableName, false);
}
}
5
3
component.getComponent<Animator>().SetBool("Slice", true);
Thank you!
3
0
Are there any code examples left?
New code examples in category C#