Topic: Multiple Button Input Not Registering

Hello,

I've noticed what appears to be a bug with the way multiple button presses are handled and I'm having trouble trying to figure out how to solve the issue. This is the scenario I'm seeing:

(functions correctly)
press and hold button 1
press button 2
TestMoveExecution gets called for the combined input of button 1, button 2. This is the expected functionality.

(functions incorrectly)
press and hold button 2
press button 1
TestMoveExecution only gets called for button 1. This is not the expected functionality.


I have tested this with many different button presses and the only common thread seems to be the fact that it only works if you hold a button that is earlier in the enum list and then press a button that is after the first held button (button 1 -> button 5 works, but button 4 -> button 3 does not work, etc).

As near as I can tell the fault lies with the call to inputController.GetButtonDown(inputRef2) inside ControlsScript. This is returning false in the incorrect instances I described above. Just to test, I changed GetButtonDown to GetButton. This solved the issue of not being able to press a high button then low button, but it created the undesirable behavior of being able to repeat a move by holding the buttons (which I'm assuming is why it was using GetButtonDown in the first place).

I'm really not sure why GetButtonDown() is failing, any and all help would be greatly appreciated. Thanks!

Share

Thumbs up +1 Thumbs down

Re: Multiple Button Input Not Registering

Do you still not get the functionality you want when you set Allow Input Leniency for the move?

Share

Thumbs up Thumbs down

Re: Multiple Button Input Not Registering

I apologize if I wasn't specific enough, but the functionality I am testing takes place before the move recognition code gets called. I have some Debug statements that I am using to test when the inputController is registering inputs, and in the cases I described the trace statements are returning false for GetButtonDown, even though both keys are pressed.

Share

Thumbs up +1 Thumbs down

Re: Multiple Button Input Not Registering

You know GetButton and GetButtonDown are reporting on two different things right?  GetButtonDown will only provide a positive on the frame the button is pressed, while GetButton is true while the button is still pressed.  And of course, GetButtonUp will be true the frame the button is released.

I brought up the functionality aspect, as I've never had any problems with inputs not registering in the game.  And the Input Leniency feature is generally what you need to play with to achieve desired functionality.

How long are you holding the first button before pressing the next one?  If more than a frame, than the first button should always be true with GetButton and the 2nd button true on the frame for GetButtonDown...

Share

Thumbs up Thumbs down

Re: Multiple Button Input Not Registering

I am aware of the functionality difference between GetButton and GetButtonDown, but thanks for the heads up.

The way the code is written it looks like the first button press is being handled with GetButton, while the second press is handled with GetButtonDown, which logically makes sense. The reason that GetButton is "working" for the second press is because it gets picked up on each subsequent frame after the initial GetButtonDown check would fail. I think the same issue is happening with GetButton, but because it checks again the next frame the error is almost unnoticeable.

I am holding the first button for a few seconds before pressing the second button, though it doesn't seem to make a difference how long I hold it down for. I get the same result every time.

Share

Thumbs up +2 Thumbs down

Re: Multiple Button Input Not Registering

Sorry, yeah I forgot to say that even with what I mentioned it doesn't explain why in your case A->B works but B->A doesn't.

Long story short, I can confirm that creating moves with your desired functionality isn't possible.  In fact, the only way I could get results was when I made the Button Execution be Button 1 and Button 2 (any order).  This way, Hold 1 then pressing 2 allows the attack, but holding 2 than pressing 1 doesn't.  So, I can confirm your results in-game (which you already knew tongue).

Have you looked in AbstractInputController?  It seems to be where all the inputs are logged before ControlScript looks for it.  I was looking in that script, but my programming knowledge isn't up to understanding most in there.  I'm suspecting that either the inputs are always in the same order in a list, rather than in order of oldest->youngest (if it's even polled that way).

Hopefully, you'll have more luck than me.  Short of MisterMind chiming in on this...

Share

Thumbs up Thumbs down

Re: Multiple Button Input Not Registering

I wasn't able to figure out the underlying cause of this issue, but I was able to implement a workaround by changing GetButtonDown to GetButton and using a bool to flag whether or not a move should fire (which resets in the GetButtonUp listener). If anyone else stumbles on this I hope that helps. If that wasn't clear I can post a more detailed explanation of what I did.

Share

Thumbs up +1 Thumbs down