I know you can set an event in an animation and it will send a message to a script where you can then change parameters, but is there a way to have an animation parameter change simply by entering or exiting an animation state or going through an animation transition. Really any way to do it outside of a script?
In the animator, go to your desired animation state, click on “Add behaviour” and create a new one. Then you can communicate with the animator in certain event functions. An example from my code:
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);
}
}
You should be using StateMachineBehaviour. You may reset the value of your animation parameter to its default value to prevent state changes.
I’m running the " RollerBall " scene from the standard assets pack , running over various NPC’s I’ve added . I want them to die when a collision occurs . I can’t get the " Any State " in the Animator component to work .