Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity WebGL Mobile browser workaround and keyboard input fix?

Hey everyone so I read that unity doesn't really support mobile browsers for WebGL games. im using 2020.1.4.And sure enough, the game gets a bit distorted by not being scaled properly. it's like the camera is bigger so it shows on the screen that blue color. I tried some things, setting width and height to auto or removing config.devicePixelRatio = 1; as suggested by a friend but nope! still looks horrible! And if that wasn't enough the keyboard doesn't show up when clicking on form fields. i tried this one https://github.com/eforerog/keyboardMobileWebGLUnity which displayed an error when pressed on and this one https://github.com/dantasulisses/WebMobileInputFix which just didn't even compile!

Any ideas, please?

like image 229
stratos la Avatar asked Oct 17 '25 16:10

stratos la


1 Answers

I did my research and tried every plugin I could find. I used Unity 2020.3.28f1 and tested both on Android-phone and iPhone.Here is my report.

These plugins don't work:

https://unitylist.com/p/f58/Unity-webgl-inputfield
https://github.com/eforerog/keyboardMobileWebGLUnity
https://github.com/dantasulisses/WebMobileInputFix

This plugin works, but you should use different settings for IOS and Android on same input field game object. If you use "prompt", it works for IOS only, and "overlay" works for Android only. Look for documentation in page:

https://github.com/unity3d-jp/WebGLNativeInputField

And this plugin works best at the moment. Yes, it is a bit ugly though, but it works.

https://github.com/kou-yeung/WebGLInput

And there is a fix for Unity 2021 for it:

https://github.com/kou-yeung/WebGLInput/releases/tag/1.0
like image 148
Oleksandr Martysh Avatar answered Oct 20 '25 15:10

Oleksandr Martysh