I am working on a jump → fall → land system. I want to determine when my landing animation has finished so that I can set my “landing” boolean to false. Here is the simple code:
// If the character is landing
else if (landing) {
Debug.Log("Landing");
animation[landingAnimation.name].wrapMode = WrapMode.Once;
if(animation.clip.name!=landingAnimation.name || !animation.IsPlaying(landingAnimation.name) )
animation.CrossFade(landingAnimation.name, 0.1f);
else
landing = false;
//falling = false;
Debug.Log("Landing is false");
}
As you can see, the landing animation is set to play once. I have commented out the boolean because otherwise it fires before the animation finishes. I have tried using !animation.isPlaying but it wasn’t working. Is there another way? Or maybe I haven’t set up the isPlaying correctly.