For joypad buttons that have a binary strength this seems to work fine as when the button is pressed and release only one event happens. However joypad triggers (like left and right trigger) set off multiple events. This maybe a poor way to handle input, so if anyone has a better way please let me know. It seems to me that there must be a better way of handling this.
What I intend to happen is when the assigned_button is pressed that it sets button_pressed to true, and button_released to false, and the opposite when the assigned_button is release. I have checks for if button_pressed == true, and if it is then it executes an ability. If the check is true and the ability is used it sets button pressed to false. What happens with the joypad triggers is that multiple events are called. So the trigger is press it sets button_pressed to true, the ability executes, and sets button pressed to false, but then another event happens and resets button pressed to true which triggers the ability again.
Maybe I should change the name to ability pressed? The reason its reset is because I don’t want the ability triggering it twice, it isn’t altering the actual input
So I switched to using Input.IsActionJustPressed(assigned_button) to handle input for abilities. But I have a queue/check systems that makes sure the ability can be used, in that system I check to see if the assigned_button is a button that changes the state of the UI (e.g. exits the UI). I think that has solved my problem.