PaperZD How to Get Animation Length

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.