I recently learned about the WebGL Input class and couldn’t call it, as it turned out, for some reason, it doesn’t install when creating the project, although the Web is installed as a module. I thought there might be a jamb in 6000.0.31, but it’s the same in 6000.0.34. I tried to add a link through Visual Studio, but when you open the project, Unity deletes it.
Hi. You can access the WebGLInput class only in Play mode (!UNITY_EDITOR
, the check is needed only if your script is running in both Editor and Play mode) and when the active platform is web (UNITY_WEBGL
), see this for an example: Unity - Scripting API: WebGLInput.mobileKeyboardSupport
So this class will be automatically added during the build? The bottom line is that others in the references (Visual Studio) have a WebGLModule, when I don’t have one, that is, I basically can’t use the WebGLInput class, since it’s not in the project.
When you have Web Build Support module installed, the class is in UnityEngine.WebGLModule assembly, which is automatically referenced by your game assembly (named Assembly-CSharp by default, if you don’t have your own asmdef file) in Play mode and in the final build.