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
- Modifying UI Prefab child's Height only confirms the first 1 or 2 digits when the Scene is newly opened or the Prefab is newly created
- ProfilingSampler.Get() returns null and makes the Player only render black when building a Release Build
- Search text field visual controls for the Path binding in an Input Actions Asset is misaligned
- Display issues in VideoPlayer when using Screen.SetResolution on certain Google Pixel devices
- Crash on Texture::TextureIDMapInsert when opening a specific project
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).