doNotCaptureKeyboard: true does not work in Unity 5.1

Hi,

As the the topic states, the doNotCaptureKeyboard option for Modul in the generated html file:

var Module = {
        doNotCaptureKeyboard: true,

Has no effect in Unity 5.1, but did in Unity 5.0.

Any idea for a solution for instead of doNotCaptureKeyboard?

Thx

We rewrote the input handling in Unity 5.1 to use a more low level implementation to fix several bugs in emscripten’s SDL wrapper. Unfortunately, that means that doNotCaptureKeyboard will no longer work, as that is handled by emscripten’s SDL wrapper. Instead, we are adding a new API which allows you to turn on and off keyboard capturing at runtime from your game code. This will be in 5.2, and possibly also in a 5.1.x patch release.

2 Likes

Hi Jonas

Thank you for replying on this topic, and thx for the heads up.

I will wait with the upgrade, until this feature is ready.

Any news about this issue? or workaround?

We are planning to include the solution to this problem in a future patch, probably next week.

Was this fixed in 5.1.1p4?

Thanks!

We are Jan 2016, is this fixed ?

A while ago we implemented an alternative solution, we just forgot to reply here…

You can use WebGLInput.captureAllKeyboardInput in your script. See also this thread.

1 Like

Also don’t forget if you don’t capture all input, you need to add something to your index page to push keyboard events to it when it is selected. Otherwise it will ignore keyboard commands always

thanks guys!