daemon3000/InputManager

Rebind Input timer not working?

Closed this issue · 7 comments

Hi, first off a big thanks for creating this! Such an amazing tool.

I've studied your Controls Menu example to try and implement my own key rebinding menu. I have implemented what I believe to be the same setup as the Controls Menu example and have not edited any of the scripts supplied. When testing, the 'button' that starts the scanner automatically registers the mouse click as the newly binded key, when I'm expecting the timer to start to allow me to select a key from the keyboard.

The new key bindings remain in different scenes, so I'm assuming I'm missing a tiny detail that might not be so obvious in the Controls Menu example scene. I have tried editing the timeout field of the RebindInput script, but with no changes in result. The only error Unity is giving me is a warning that there are two EventSystems in the scene.

I might be missing something silly, but any help would be greatly appreciated :)

rebindinputsetup

First of all, what Unity version are you using?

When testing, the 'button' that starts the scanner automatically registers the mouse click as the newly binded key

Does this happen in the in the example controls menu as well or is it something specific to your custom menu?
Are you using the custom standalone input module(Team Utility/Input Manager/Use Custom Input Module) for the event system?

The new key bindings remain in different scenes

I don't understand this. Can you provide more details?

I'm currently using Unity 4.6.1

The issue only occurs on the menu I have created. In the example, I am able to select a new key from the keyboard within the 10 second time limit.

I have the Stand Alone Input Module script applied in the event system gameobject, however when I try and click on the 'Use Custom Input Module' option that you've described above, the drop down menu disappears but it is not obvious whether clicking this option has made a change anywhere.

When I click the 'buttons' the new keys that are assigned to those controls are saved as expected and I can use them in my game scene, so I assume that the script is actually working, but I am unable to select a key from the keyboard.

image

The menu option doesn't provide any feedback, it just does it's job. I guess I should fix that.

To be honest I don't really understand what the problem is. From the initial post it sounds like when you click the rebind button it automatically selects Mouse0(left mouse button) so you can't assign anything else. However in the last screenshot I can see that you are able to assign Mouse1 and Mouse2(which would mean that the keyboard doesn't work for some reason) or are those the default bindings? Can you clarify which situation is the correct one?

I can assign Mouse Buttons, but not keyboard keys. The default bindings are the same as provided in the default_input file.

Sorry if my explanations are a bit long winded.

Can you send me a unity package with your menu setup where the issue can be replicated so I can debug it? Since it's something specific to your implementation I can't help you if I don't see what you did.

I have sent you an email with the package attached. Thank you.

I finally tracked down the source of this issue and it seems to have something to do with the EventSystem game-object that is used by the UI canvas. If you create the input manager first and then the event system game-object, the input manager will receive mouse events one frame after the event system so by the time those events are received the UI button has been pressed and the input scan has started which causes the mouse keys to be immediately selected.

The solution is to create the event system first and the input manager. Alternatively, you can edit the rebind script to delay the scan start by one frame using a coroutine.