Very low resolution upon startup causing blackscreens

Hi,

We have been having issues for a while now where some users will experience a black screen on startup where the game can be heard and interacted with but the screen is black. I’ve tracked this down to the resolution on startup being values like 0x0 or 1x1 and If I check the .plist file I can see these values.

I’ve tried deleting the plist but Unity regenerates it with these very low values.
I’ve tried explicitly setting the values in the plist but once again no luck

We have the Default Native Resolution enabled in PlayerSettings as well as Retina support.

In game we set the resolution using the Screen.SetResolution and my understanding is this should be saved to the plist file but upon launching the game it is again at a very low value causing a black screen.

So far, the only work around I have is detecting a resolution below say 640 x 480 and then forcing the resolution to be the first entry in the available resolutions. This works for that session but upon exiting and reloading it will return to a low value and the code to check the low resolution is fired again to use the first entry.

Any thoughts on why this might be happening?

1 Like

Hi,

Regarding “I’ve tracked this down to the resolution on startup being values like 0x0 or 1x1”, are you sure the black screen is related to this? On my Mac I often encounter the black screen on startup, which looks like hanging. I am not sure if anything else is happening in the background because there are no sounds, but I know that the render thread can crash independently of the audio-related thread. Sometimes I am getting even a kind of “white noise” on startup.

Regarding your workaround, wouldn’t it be better to set the resolution to the native one instead of the first entry in the available resolutions?

var display = Display.main;
//Screen.currentResolution works properly only in Windowed mode at this point
nativeDisplayWidth = display.systemWidth;
nativeDisplayHeight = display.systemHeight;
Screen.SetResolution(…);

Every time I have seen the black screen issue it’s been due to the resolution being set at silly numbers by the plist file.
We did have some black screen issues prior to this when doing async scene loading but this was fixed in an LTS patch. We’re currently running 2021.3.37f1.

Regarding using the native resolution, I will give that a go. My intent with setting it to the first entry was purely to make it usable but I think native probably makes more sense,

Same issue on 2022.3.33f1, can be reproduce by press full screen button of a windowed player, the resolution set to 0x0.
We encounter this problem by upgrading Unity version from 2022.3.16 to 2022.3.33

2 Likes

We had the exact same problem with Unity 2022.3.33. It is now fixed for us in Unity 2022.3.44. I guess it was fixed in 2022.3.40:

  • macOS: Fixed resolution not resetting to full screen when going to full-screen window by using native MacOS UI controls. (UUM-73633)