-2

Here is the input type number

<input type="Number" id="yPos" />

it is working fine and i am able to change it through mouse

enter image description here

But it is not getting numeric input from keyboard. How can i enable it?

Edit: I found that UnitywebGL is creating this problem otherwise the keyboard input is working correctly in html controls.

Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186

2 Answers2

0

Actually there is no issue with the html input field. It was related to the unity webgl:

Keyboard input and focus handling. By default, Unity WebGL will process all keyboard input send to the page, regardless of whether the WebGL canvas has focus or not. This is done so that a user can start playing a keyboard-based game right away without the need to click on the canvas to focus it first (source).

So the Unity canvas was consuming my all keyboard input. No matter I tried to enter/select my input control, it will not get input from keyboard. So I used

WebGLInput.captureAllKeyboardInput 

to activate/deactive unity canvas input based on user selection.

Muhammad Faizan Khan
  • 10,013
  • 18
  • 97
  • 186
-1

First, correct the form. The type should be "number" without caps, i.e:

type="number"

Also check if you have turned off the num lock.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Mak Web
  • 9
  • 2