moritetu / nuxt-unity-webgl

Vue composable introduces component and utilities for unity WebGL container
MIT License
3 stars 0 forks source link

Cannot input text on textarea input fields on overlaid elements #3

Open dataexcess opened 1 year ago

dataexcess commented 1 year ago

i am using the NuxtUnity component and on top of it are normal html/nuxt elements that require user input. Unfortunately this does not seem to work anymore: no more text is being processed. it seems like all key input is stolen by the nuxtUnity component?

moritetu commented 1 year ago

Hello, thank you for your reporting! 🙏

I looked into this matter. Unity's WebGL documentation states the following:

By default, Unity WebGL processes all keyboard input the web page receives, regardless of whether the WebGL canvas has focus or not. 

https://docs.unity3d.com/2021.2/Documentation/Manual/webgl-input.html

You will probably need to make a call to disable keyboard input capture in your Unity script when focusing on the Input area.

 WebGLInput.captureAllKeyboardInput = false

There is an example below, please refer to it.

https://docs.unity3d.com/2021.2/Documentation/ScriptReference/WebGLInput-captureAllKeyboardInput.html