I create webgl build, upload to server, and with first click my game turn on fullscreen! How to disable it?
Any luck figuring this one out?
There is still no solution (
I’ve created tons of webgl builds over the years and none of them automatically goes into fullscreen. I haven’t created a build in the last months but I never ever had any issues. See for your self. Here’s a list of several examples I created. I created this Zelda BOTW like health bar example about 3 month ago. So if you have issues with fullscreen you should probably check your build settings.
In my assemblies, the first click anywhere puts the game in full screen mode. I don’t understand what’s the matter
I solved it. In my assembly for WIN, full-screen mode was set in the Start method. In the build for the Web, it worked on click
I’m also experiencing this problem, how did you manage to solve it?
I was able to stop the Unity WebGL fullscreen default action for my Unity 2019.1.3 project by editing the UnityLoader.js file found in the “Build” directory created when you make a build.
I removed “(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf(“Safari”)==-1||s>=10.1)?1:0” from the “hasFullscreen:function()”.
B E F O R E :
hasFullscreen:function(){var e=document.createElement(“canvas”);return(e.requestFullScreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullScreen)&&(a.indexOf(“Safari”)==-1||s>=10.1)?1:0}
A F T E R :
hasFullscreen:function(){var e=document.createElement(“canvas”);return}
I have not thoroughly tested this yet on all browsers, but so far it has stopped the “dreaded FullScreen attack” when viewing my WebGL build in Chrome, firefox, Vivaldi and Safari browsers.
Clearly this is a hack.
I solved the issue by removing “hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen” this line in
[gamename].loader.js file can be found in build folder after the build.
I found the problem. Somewhere in my code, I had “UnityEngine.Screen.fullScreen=true;”. Remove this code and problem will be solved :-).
1.[gamename].loader.js file can be found in build folder, open in vscode
2. copy inside quotes “hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen”
3.back to vscode, ctrl+find, paste, delete, save.
4.reup
thank you
RiyadhRiseUp