Hi folks, building for webgl My fullscreen doesn’t seem to scale properly in chrome or opera(i understand opera isn’t supported at the moment). When i hit fullscreen it actually gets smaller and I can’t seem to find anyone else with the issue… Firefox works perfectly but whether I use Screen.fullScreen=.fullScreen; in a unity script or onclick="SetFullscreen(1); in the HTML it doesn’t properly fullscreen at all… The link shows a screenshot of the result of going fullscreen Fullscreen error unity webgl chrome - Album on Imgur
Issue seemed to be resizing in CSS, careful not to resize canvas in css for chrome at least, as this may cause issues when switching to fullscreen
Hi there! Try this one:
private void Awake()
{
switch (Application.platform)
{
case RuntimePlatform.WindowsEditor: isFullScreenNow = false; break;
case RuntimePlatform.WebGLPlayer: isFullScreenNow = Screen.fullScreen; break;
}
defScreenWidth = Screen.width;
defScreenHeight = Screen.height;
}
public void ChangeScreenMode()
{
if (!IsFullScreen())
{
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
}
else
{
Screen.SetResolution(defScreenWidth, defScreenHeight, false);
}
isFullScreenNow = !IsFullScreen();
Debug.LogError(this.gameObject.name + " Was Clicked. Full screen = " + isFullScreenNow);
}
public bool IsFullScreen()
{
return Application.platform == RuntimePlatform.WebGLPlayer ? Screen.fullScreen : isFullScreenNow;
}
Running into the same issue here on Chrome Mobile (clients… don’t ask…), and found this thread.
The script above gives me a Unexpected symbol `void’ error.
I know this is an older thread, so I hope someone will respond ![]()
thanks!
rob