Here’s the function in my level check that disables input after the player dies: goes to game over screen, enables input, then you loop back to main menu.
That works perfectly, except if you die while shooting. This is a section on the base weapon blueprint, that controls the automatic fire using gate. I highly suspect it has something to do with this.
The button is kept pressed, but since input was disabled, then it gets stuck. I’ve tried adding a reference to the player in the weapon blueprint and somehow have an IsDead? variable that disables the gate but haven’t been succesful.
Maybe it has nothing to do with the gate - but nothing I do animation-wise seems to be able to get the player unstuck from shooting when dead.
Anyone have any suggestions to avoid the stuck firing? Thank you!
I have tried making sense of that answer but still haven’t fully figured out what they were trying to say. Have you dealt with this issue? Do you have a more visual way to represent what the solution was?
I am also wondering why Unreal doesn’t clear the input memory when using the built-in Disable Input function. I wonder if this should be a default behavior? Would anyone benefit from having the last input key be ‘stuck’ forever after disabling input?
Any more suggestions on how to deal with this will be appreciated. thanks.
You disabled the entire input system so it can no longer detect keys going up. You should be able to tell the controller to flush input manually:
Another way is to not disable input but instead work with the Enhanced Input system. That’s what Mapping Context is for - you can add, and you can remove it on the fly. The whole thing or parts of it, and override priority.
Thank you both for your input! I tried to make them work as you both suggested but I ended up going a different way, and it worked! I took the “StopFire” event from the Weapon Event Graph inside the character’s BP and added it before the disable input in the death sequence. This did the trick, no more stuck firing after death.
I appreciate your suggestions and I’ll keep trying to fully understand the methods you suggested as I’m sure this won’t be the first time I run into this.