- Home /
Program way to get fullscreen in WebGL
Hi guys! I've been trying to figure out the program way so as to get fullscreen in WebGL without any extra mouse/keyboard actions from the client side. Are there any options to reach it? Any of them will be highly appriciate including cheats/tricks/hooks and so on.
Currently i've got the only manual way (by mouse click):
public void ChangeScreenMode()
{
if (!IsFullScreen())
{
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
}
else
{
Screen.SetResolution(defScreenWidth, defScreenHeight, false);
}
isFullScreenNow = !IsFullScreen();
}
Answer by FortisVenaliter · Sep 21, 2017 at 03:52 PM
Assuming you're calling that code from a mouse click handler, why not just call it from the Start function?
Since it requires any user interaction to be activated due to the security reason, which is described here: https://docs.unity3d.com/$$anonymous$$anual/webgl-cursorfullscreen.html The only question now is how it could be foolished? And could it be at all?
No, that's a legitimate security reason. How would you like it if you browsed to a website and it suddenly took over your entire monitor and doesn't have an escape button?
I see. That's a pity actually. For sure it must be secured but at the time it could be more flexible as well.
Your answer
Follow this Question
Related Questions
Application.ExternalEval is deprecated. What should I use? [Unity 2019.3] 0 Answers
choppy mouse in webGL build 0 Answers
Unity3d Webgl build and angularjs 1 Answer
Unity webgl or threejs or babylonjs ? Which one is the best for me? 1 Answer
Textinputs not working when I implemented "Unity webGL" in VueJS Project 1 Answer