Use remains active after OnAnimatorItemUseComplete event

I'm using the Use ItemAbility for a melee attack, I have to have it set to wait for the animation event rather than time because I'm using a combo attack set up.

If I spam the attack button, eventually I noticed that in my animator the animation freezes because the Slot0ItemStateIndex parameter is stuck at 1 instead of resetting to 0 when the animation event fires, which is even weirder because the Slot0ItemSubstateIndex is being reset to 0.

The only clue I've found so far is that the Use ability is remaining as active even after the OnAnimatorItemUseComplete event fires.
 
If you want to wait for the OnAnimatorItemUseComplete event, you have to adapt the use rate of your weapon so the player can't fire before the use is complete. The use rate must be larger than the time between fire and complete event. This way you can avoid overloading / spamming your system.
 
But I need the player to be able to press the button again before the attack is complete to start the next attack in the string. Wouldn't increasing the use rate prevent that?
 
If you increase the use rate (which is actually a wait time), the button press will be ignored until the time is up. The button press will be ignored during that time. If you are waiting for the animation event, the animation event has to be triggered. Otherwise you will end up in an undefined state. The demo animator is not robust enough for spamming the attack button. The problem is that it freezes due to missing transitions. You try starting the item use while it is still in use. So, you need to make your animator more robust to cover all possible transitions.
You can also try not using the animation event, but to use a fixed time for ending the use. But still you need to wait for the item use to end before triggering a new one.
 
After doing some more tests, spamming the button isn't the problem. It seems to be occurring if I press the button at the same time that the event is firing.

I can't raise the use rate because the player needs to press the button before the complete event in order to do the next attack in the combo.
 
After a bit of testing, I've narrowed it down to somehow the Use ability is either being added, or not removed from m_ActiveItemAbilities in the UltimateCharacterLocomotion.

I've also noticed that when it breaks, in Use.cs in the UseCompleteItem method, m_WaitForUseCompleteEvent[slotID] returns true, not sure if that is helpful or related.
 
Unfortunately this is going to require me to step through it to determine what is happening so being able to reproduce it would be great. If the use ability is ending though you could place a breakpoint within AbilityStopped to see what is causing it to end.
 
So, my VS won't hook into Unity so breakpoints aren't working for me.

I can't make it happen in the demo scene in my project either, so I can only guess there's something wrong with my animator.
 
I moved the animation event to be a little bit earlier in the animation and that seems to have worked. Either that or I just can't hit the timing, but I'm going to assume there was something weird going on with the event timing and animation transitions. Thank you for your help!
 
Top