Damage Visualization ability not lasting the full duration? Why

kentreva

Member
Hi! I'm running into an unexpected behavior where the default Damage Visualization ability ends sooner than the duration set in the inspector.

Looking at the code for this ability, the StopAbility is run when this duration is finished.
1654548762709.png
1654548777427.png

But when I even set this to 1000secs, the ability stops almost immediately, and the "Take Damage" state reverts too.
1654548562040.png
You can see the behavior here:



How can I keep the "Take Damage" state active for a set amount of secs from this ability?
Is that not the intended behavior of the Duration property here?
 
For context, I'm trying to implement "invincibility frames" after a character is hit.
My planned approach was this:

1. Use the existing Damage Visualization (or inherit)
2. Set the ability to set state to "Take Damage" (default behavior)
3. Add "Take Damage" state to the Character Health component.
4. In this Take Damage state, preset for the Character Health component sets Invincible = true
5. Set the ability duration to be 1 second so that the Character is invincible for 1 second after getting hit.
 
The DamageVisualization ability registers on the "OnAnimatorDamageVisualizationComplete" animation event, and the demo animations trigger this event. So, the time you set is not taken into account when the animation event is triggered beforehand.
 
Top