How to check for pressed keys in WebGL?

Hi there,

In my project i check if a configured key is pressed during update as follows:

void Update() {
  if(Input.GetButton("Player 1 left")) {
    ExecuteAction();
  }
}

When i “Build and Run” for WebGL and test the controls in Chrome (43.0.2357.134), the keypress is not recognized.

For my button configurations i use the “asdw” keys - this configuration works fine in the editor.

I already tried to set the focus on the canvas as follows, but still nothing fires:

http://gamejolt.com/community/forums/topics/unity5-webgl-game-doest-take-keyboard-focus/9253

http://forum.unity3d.com/threads/urgent-webgl-keyboards-event-not-working-when-in-a-iframe.299215/

Is this a known problem?

Thanks -
Michael

Nevermind, i used the wrong platform compilation constant, so my code was not even compiled.

Make sure to always use UNITY_WEBGL when working with WebGL :wink: