- Home /
How to check if animator is in crossfade
Hi!
I have written a script, that only performs an action if the animator is in it's idle state. I realized that it looked kind of clunky, so I changed the animation from animator.play to animator.crossfade, but now it will repeat the animation from the start if it's currently crossfading, but not if the crossfade is over and the animation is playing. How do I check if my animator is crossfading or prevent it from looping during the fade?
if (Input.GetKeyDown (KeyCode.J) && anim.GetCurrentAnimatorStateInfo(0).IsName("fighting_idle") ) {
anim.CrossFade ("uppercut", 0.1f, 0);
}
Answer by JeffHardddyyy · Dec 16, 2016 at 03:51 PM
For anything, Do in a line on its own (for what you listed, I'd do it under "anim.CrossFade ("uppercut", 0.1f, 0);
Do Debug.Log("Enter message here");
This will allow it so when it gets to that point, it would say in the inspector "Enter text Here"
Another way to do this is print("Message");
Your answer
Follow this Question
Related Questions
Why when creating new animator controller for the character the character is not walking right ? 0 Answers
Using AirBrakes on mobile device with Standard Assets AircraftController 0 Answers
why tansform.Translate is not working? 1 Answer
[C#] Save/Load Score stays at 0 even when changed 2 Answers
Issue with mecanim playing an animation using setbool 1 Answer