Input System works with UI not with hardware keyboard
Using 0.2.8 preview using Unity 2019.1.0f2.
void Awake()
{
controls = new InputMaster();
controls.Player.Movement.performed += ctx => Move(ctx.ReadValue<Vector2>());
controls.Player.Movement.cancelled += ctx => Move(Vector2.zero);
controls.Player.Jump.started += Jump;
controls.Player.Jump.cancelled += EndJump;
}
private void Move(Vector2 _axis)
{
Debug.Log(_axis);
axis = _axis;
}
This is my code. So on playing the game the Keyboard input doesn't work. I also have on-screen controls to which I have added OnScreenButton script to trigger the right arrow key. So when I run the game the keyboard does not work but surprisingly the On Screen Buttons work and print the debug message. I have changed Input Handling to both. On switching it to both at least the UI buttons work but with Input System(preview) neither the keyboard nor the UI works. I have attached a video in which the problem is shown Video.
@kartikey0303 UI is not support by Input System yet. Without seeing the project, it is very difficult to tell what the issue is. I couldn't repro this on my end. Please feel free to use the Bug Reporter in Editor, so a minimal repro project can be attached. Thanks.
@JiaUnity Can you clone this repository Repo and make changes to PlayerController for 0.2.8 Input System. I am using this repo as the base for my game. Can you check if the Keyboard works then?
I can confirm a similar problem. Using any 2019 version of Unity no hardware input at all is received by the InputSystem. I tried with direct input, as well as input actions and input asset. On my brother's PC with the exact same setup and packages my code works as expected.
Because the documentation is not complete I am not 100% sure if I configured everything right, but as my brother and me are using the same Git Repository the project settings should be exactly same?
Do you have any hints for me, why this could happen?
@kartikey0303 I tried your project, no issue on my end with 0.2.8-preview. Both keyboard and xbox controller work at the same time.
Also, for your InputMaster asset, if you set the Movement type to Vector2 instead of Axis, you can bind controller stick directly instead of using the 2D Vector Composite binding.
@FRazor95 It is very difficult to tell what the issue is. What kind keyboard and mouse do you have? It could be the keyboard is considered as a HID instead of full keyboard, but I'm not sure at all. You can open the Input Debugger window by go to Window -> Analysis -> Input Debugger. It has all the devices listed and, once in Play mode, all the Input Actions as well. This only works for ISX, not the old one.
@JiaUnity Thanks for your reply! I will check this later and give you feedback.
As I think this is rather not a bug in the InputSystem but an issue local to my computer, is it ok to discuss this here or should I move to the forums instead?
Currently having the same issue as @FRazor95 but on multiple computers. I’ve checked in with my testers and out of 20 that has tested my game since updating to unity 2019 and input system 0.2.8, 4 of them has no hardware input at all where it works fine for the remaining 16.
Not sure a minimal project can be made since it seems to be hardware dependent. Is there a way to output the relevant device information to the log file (testers don’t have access to the input debugger)? @JiaUnity
@JiaUnity I just observed inputs with the Input Debugger. What I was able to find is that there are 2 devices under the devices tab, name "Keyboard" and "Mouse", if I inspect these, inputs are triggered as I click and type but looking at the details, the values seem incorrect (on left click, value of leftButton is 0). But there are also 8 devices under the "Unsupported" tab, including my mouse (it's actually showing 3 times?) and two "USB Keyboard".
If my mouse and keyboard were indeed considered unsupported, is there anything I can do about it? Do you know how to solve this problem? I can tell that the mouse and keyboard I am using actually have to be compatible in general, because as I said in my first comment, my brother uses the exact same mouse and keyboard.
FYI:
My mouse is the SteelSeries Rival 300 and the keyboard is a Fujitsu KB910.
@JiaUnity @SKroell @kartikey0303 I just found the solution to the problem occuring on my pc. I went to the device manager and under input devices there were "Logitech Gaming Virtual Keyboard" and "Logitech Gaming Virtual Mouse". I actually do not know how these two came to my computer but I can imagine they were installed alongside my Logitech Headset drivers.
I would suggest you also check your input devices for any virtual keyboards or mice, maybe it solves your problems as well. After deinstalling the two mentioned devices everything works fine and as expected! :)
@FRazor95 @JiaUnity I can confirm that my keyboard is being shown thrice in Unsupported Devices list in Input Debugger. There is also a separate Keyboard Input too which does reflect the keys that I press as shown in the video that I linked in the first post. Although I do not have any Virtual devices in the device manager. I am not sure what to uninstall to get the input working. @FRazor95 For you the virtual devices were present in "Human Interface Devices" branch?
UPDATE: I tried the same project on different computer and it works flawlessly. Probably some problem with the hardware support then.
Its not 'Virtual Keyboards' or similar that's causing the issue for me either. Switching keyboards does nothing as well. @kartikey0303 If you ever find a way to get it working on the computer where its currently not working, let me know how you fixed it.
@JiaUnity I can confirm that the issue still exists on 0.2.10-preview.
Can confirm that this issue has happened in my project as well, it was downloaded around 1000 times and some Windows users have reported that the game isn't responding to their keyboards. I ended up using the new input system for gamepads and the old system for keyboards.
Sadly, I could not understand from them a specific hardware spec for you guys to investigate.
@kartikey0303 Judging from the video (thanks!), it looks like the keyboard device itself continuous operating just fine and looks like it's just the actions that stop picking up input correctly. Are you still seeing this issue as of 0.9.3?
@Nirlah Does the keyboard stop working or simply never work with the UI? What part in particular is not working? Text input? Navigating with arrows and submitting with enter and that kind of stuff?
@Rene-Damm
It not specific to UI, the keyboard didn't respond at all on the problematic systems.
Was not using the binding system but reading input directly through Keyboard.current.
@Nirlah Are you still seeing this issue? If so, could you file a bug with the Unity bug reporter?
Closing this issue as part of migrating our issue tracking to FogBugz.