How to enable fullscreen mode in webgl 1 click?

Hi all!

When working with WebGL build I’m trying to enable full screen mode.
When working with the standard template no problem.
I put in the GUI button and by pressing it launched different versions of the scripts.

Code (CSharp):

Screen.fullScreen = !Screen.fullScreen;

Code (CSharp):

Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, true, 30);
  1. A call to an external script, didn’t work
    Code (CSharp):

    Application.ExternalEval(“SetFullscreen(1)”);

Everything works and switches to full screen mode correctly. The problem is that it requires not 1 but 2 clicks of the mouse. The first button, the second click in any area of the browser, then starts a full screen mode.

Tell me, is there the possibility to switch to fullscreen mode of the game, with 1 click on the button standard template.

Thank you!

1 Like

2 Answers

2

Helped.
Changed event Mouse Click to Mouse Down, and it worked.

Here’s a thread about the same problem (and solution) as already answered: https://forum.unity.com/threads/enable-fullscreen-webgl.441174/

delete all related folder and plugin of unity ads, close the unity , again sign in to your account and on the ads.