Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

Confused input field with captureAllKeyboardInput and OnValidateInput() in WebGL

$
0
0
I have two strange behaviours using the Unity input field in WebGL. 1) Input field and OnValidateInput() I have an input field defined as content type 'decimal number'. That works fine so far. Now I want to prevent the input of a minus sign. Therefore I added an OnValidateInput() custom callback. But from now on, it is also possible to enter letters into the input field. The check for decimal number input seems to be ignored now. Is this the expected behaviour? I know how to implement a user defined check for decimal numbers, this is not my problem. 2) Input field in WebGL and captureAllKeyboardInput I have an input field inside a canvas and also a HTML input field. To be able to get input for the HTML input field I have to set captureAllKeyboardInput = false. After setting captureAllKeyboardInput back to true, user input in the Unity input field is repeated. E.g. the user enters "1" but the input field receives "11". After the next toggle to false and back to true the input field receives "111" and so on... If I never change captureAllKeyboardInput, everything works fine. But each switch to false and back to true seems to confuse the input field. To solve this behaviour, I added an OnValidateInput() custom callback. In this callback I remove input which is received inside a defined time interval (e.g. 100 ms). Thanks for any hint.

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>