简体   繁体   中英

How to fix blacksreen when changing resolution in Unity

I made a 2d game, which worked fine when I built it, but after I implemented a resolution change, it failed to render everything properly and only rendered the player.

I've tried removing these lines, but it hasn't helped. Every build after that has that resolution (I can see it being applied to the player) and fails to render the rest.

I use this at the start of the game.

Screen.SetResolution(160, 144, true, 60);

I also got these, but I'm unsure if they are related.

Multiple managers are loaded of type: InputManager
Multiple managers are loaded of type: GraphicsSettings
Multiple managers are loaded of type: PhysicsManager
Multiple managers are loaded of type: QualitySettings
Multiple managers are loaded of type: Physics2DSettings
Multiple managers are loaded of type: VFXManager

Assuming you are using desktop:

To set a specific full-screen mode on a desktop platform, use the method overload that accepts the FullScreenMode parameter.

public static void SetResolution(int width, int height, FullScreenMode fullscreenMode, int preferredRefreshRate = 0); 

https://docs.unity3d.com/ScriptReference/Screen.SetResolution.html

The fullscreenMode parameter can be one of these types:

ExclusiveFullScreen
FullScreenWindow
MaximizedWindow
Windowed

https://docs.unity3d.com/ScriptReference/FullScreenMode.html

ie:

Screen.SetResolution(160, 144, FullScreenMode.ExclusiveFullscreen, 60); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM