Hey everyone, I build a PWA WebGL build and my fullscreen script is this simple method:
using UnityEngine;
public class FullScreen : MonoBehaviour
{
public void ToogleFullScreen(bool isFullScreen)
{
Screen.fullScreen = isFullScreen;
}
}
the problem is when I press the button, I have to click or press a key then the full screen is applied but the F11 key works just fine. I even upload a test project here
Thanks bugfinders.
That’s a bummer!! shouldn’t pressing a button in the unity canvas be considered as a user interaction? it is just irritating that the user should click somewhere else to apply the fullscreen! is there a work around for it, I don’t know can I fake a user input or something after the button is pressed?
i think the reason your stuff isnt working is that the first click is actually focusing the game also i can click your “full screen” button twice and it goes full screen, so its like the bool is incorrect.
thanks for the great free assets, a minor bug though the buttons won’t change when I go fullscreen with the F11 key.
I tested on Google Chrome and my Unity version is 2022.3.4. but it seems to handle all the other scenarios. (I just built your example scene.)