Ability Animator Inconsistency

LeoLFerraz

New member
Hi, all!
I've implemented a simple 'stagger' ability, which is activated when a character takes damage and stops itself a given time afterwards. It's used to:
- Interrupt all other abilities;
- Keep any other ability from starting; and
- Triggering a flinching animation, showing that the character has been damaged.

The ability always activates and deactivates correctly, but the animation does not always trigger. It is inconsistent, varying from play session to play session, per character. That means every time I start play mode, a character might or might not flinch when hit. A character that flinches, consistently flinches during that play session, though.

It's an odd bug and I honestly don't know where to begin debugging. Any tips?
1667859126896.png1667859148385.png1667859158366.png1667859167142.png
 
When the AbilityIndex is set I also using the Ability Index Change trigger. Besides that you can enable logging on the Animator Monitor to determine if the parameters are being set to what you think they should be set to.
 
Hi, Justin. I found the source of the bug. Using the 'SetEnabled' lifecycle event was the root cause. Apparently, it doesn't trigger when the ability is initialized (which is fine, but could be made clear on the function summary), but it DOES trigger when the component is active in the inspector. That was the reason for the inconsistency: the stagger would work when I had selected the character on the hierarchy during that play session. It wouldn't otherwise.
I've changed my code to use the 'Start' event instead and all is fine now :)
Thank you for your assistance!
 
Top