Question by
no00ob · May 24, 2018 at 08:33 PM ·
uiscreenbooleannot workingfullscreen
Why my Screen.fullScreen isn't working?
I have made a settings system that Brackey made a while ago, but my fullscreen toggle just doesn't work, it places it into full screen only if I launch it in window mode other wise it will just ignore it if I tick the check box off that should change it. (And if that was unclear this code is run when ever I change a UI check box, the check box UI element is by default set to false)
public class Options : MonoBehaviour {
public void SetFullscreen (bool isFullscreen)
{
Screen.fullScreen = isFullscreen;
}
}
Comment
Best Answer
Answer by MauricioPartnoy · May 30, 2018 at 12:26 PM
I watched the same tutorial. As it didn't work for me either I tried using Screen.fullScreenMode with good results, like so:
public void ToggleFullscreen(bool fullscreen)
{
Screen.fullScreen = fullscreen;
if (Screen.fullScreen)
{
Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen;
}
else
{
Screen.fullScreenMode = FullScreenMode.Windowed;
}
}
You should set your toggle's start value too, for it to be consistent with the one in the build's launcher. I hope this helped! :)