Search Issue Tracker
Won't Fix
Votes
1
Found in [Package]
1.0.1
Issue ID
1303619
Regression
No
Keyboard input is not processed when using the InputSystem and Player is hosted in a WPF application
Reproduction steps:
1. Open the user's attached file
2. Navigate to keyboardControlsInsideWpf/bin and launch UnityShellTest.exe
3. On the left side of a window, select New
4. Use arrow keys to move around
Expected result: The Camera is moving
Actual result: The Camera is not moving
Reproducible with: 1.0.0-preview.1 - 1.0.1 (2019.4.18f1, 2020.2.2f1, 2021.1.0b2)
Not reproducible with: 2018.4.30f1 (could not downgrade InputSystem package)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- URP Realtime reflection probes do not update when RenderProbe() is being called once per second
- Addressable terrain shader variants are stripped from the Player
- [iOS] Debug.Log() appears as <private> in Console app
- UI stays in the background when it is disabled in simulator
- A wrong log file is attached when project is launched with a "-logFile" command line argument
Resolution Note:
On Windows, raw input (https://docs.microsoft.com/en-us/windows/win32/inputdev/about-raw-input) messages for keyboard do not propagate to child windows if they're hosted in a different process. Since the new input system uses raw input for keyboard input. it receives no keyboard input when hosted inside another process.
As a workaround, you can call RegisterRawInputDevices (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerrawinputdevices) to register your WPF app HwndHost to receive keyboard RawInput, and then forward the WM_INPUT messages you receive in the WndProc to the hosted Unity process via SendMessageW (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagew).