For my windows standalone project I selected Fullscreen mode: Windowed @ 1024, 768 and ticked Allow Fullscreen Switch in player settings. To my surprise the resolution does not automatically get adjusted when switching to and from full screen mode (unity is this a bug?). I now manually adjust the resolution which sort of works, but Im not sure Im always getting the correct resolution (ie native for the appropriate monitor), especially when multiple monitors are involved. Has anyone found a better way than the code below?
// I call this from Start, and from Update when _previousFullscreen != Screen.fullScreen
void AdjustResolution()
{
var r = Screen.resolutions.Last();
_previousFullscreen = Screen.fullScreen;
if (Screen.fullScreen)
Screen.SetResolution(r.width, r.height, true, r.refreshRate);
else
Screen.SetResolution(1024, 768, false); // use preferred resolution
}
Another issue is when I restart the app I want a fresh start, not to have a previous resolution applied. Can this be fixed in unity or is this a windows issue?
Cheers, Bas