PaperZD How to Get Animation Length


image



My Blueprints are like this, when i call the attack function it sets “is attackin” to true and then spawns the projectile, because of is attackin true it plays the “attack” animation, and then i get the flipbook length but to set a timer and then set is attacking to false again to get back to idle animation. The issue is get flipbook length in picture 1 is wrong, when i test this version it plays idle way before attack animation is finished. How could i get the true length of attack animation or is there a easier way.

There might not be enough time between setting the IsAttacking boolean true and getting the flipbook length. I would try adding a very small delay between setting IsAttacking true and getting the flipbook length. Another option may be to let the animation trigger your spawning projectile with an animnotify. So, set attack to true in your function then in your attack animation timeline in the AnimationSource, put in a notify for when exactly you want to spawn in your projectile. Then in that notify put the spawn actor/projectile logic.

However, I realize this may solve your problem, but it doesn’t answer the question. I had a similar question about animation lengths I was about to ask. So to anyone else who may know:

Say you have a blocking animation and you want to put in a blocking cooldown like (blockingAnimationLength float + 0.2 seconds) How can you get the animation length to set blockingAnimationLength float on BeginPlay? It seems like you can only ever access the current animation, but access to animation data for the animations listed in AnimationSource blueprint would save a lot of headache.