Skip to content

[WebGL] Mouse/keyboard not detected at all (even in a new project & fresh build) #675

@DarrenRuaneKaizen

Description

@DarrenRuaneKaizen

I have a personal project that I just migrated over to the new Input System and it all works great when playing locally in the editor (and also in Windows Release & Dev builds). However, when building the game for WebGL, it appears as though no input is detected at all.

I'm running on Windows 10 x64 and have this problem on Unity 2019.1.5f1 and 2019.1.6f1.
The problem is prevalent when running the WebGL build in Microsoft Edge, as well as when running it in Chrome on the local NodeJS server that Unity instantiates via the Build & Run option.

Steps to reproduce

  1. Create a new, blank project.
  2. Add the Input System package to the project via the Package Manager.
  3. Enable the input backends in the project settings (set Active Input System to Input System (Preview)).
  4. Create a test GameObject and add a PlayerInput component to it.
  5. Click Create Actions... and create the default Input Actions.
  6. Set the Behaviour to Invoke Unity Events.
  7. Map an action to a custom script method (I just tested it with Move, but it is also broken on my personal project for every action: Move, Look & Fire.
  8. Make the custom script method do something in-game in response to the Input Action callback (I made it move my test GameObject's Rigidbody) to assert that it's being invoked.
  9. Run the project locally and confirm that it works in the editor.
  10. Build for WebGL and run.
  11. Input is not detected at all.

Expected and Actual Results

It is expected that input via the default PlayerInput's InputActions is detected in WebGL builds.
This is not the case however.

Additional Information

I've just done a development Build and Run with the profiler attached and then opened up the Input Debugger. The option to Show remote devices became enabled and, after clicking on it, I discovered that there was an Autoconnected Player with devices labeled 'Keyboard1' and `Mouse1' shown. Upon inspecting their realtime event data (via the double-click dialog) I can say that there is definitely no input being detected.

I do not have another mouse and keyboard attached to my machine.

I took a quick look in the source files here on Github and saw an interesting Unit Test named 'Remote_ExistingDevicesAreSentToRemotes_WhenStartingToSend' here. From what I can tell judging by the name, it appears that the expected behaviour is that the existing devices are sent to the remote(s), but that certainly does not seem to be the case for me.

Here is an image of what I see in the Input Debugger in hopes that it helps:

Capture

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues where existsing functionality misbehaves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions