- Home /
How do I clear my screen after changing resolution?
I've made a simple way to change resolution for my game whilst its running. It all updates fine. However when going from, say 1920x1080 resolution down to 800x600, I've noticed that the screen does not update the far right and left. Instead an image of what WAS there is left behind.
I've tried drawing over it with a black Quad/texture before the resolution change is applied, but it doesn't work. I've tried to use SceneView.RepaintAll() but that isn't even recognizing. I can't think how to get rid of the clips on the sides of my screen so they are plain black.
Any suggestions would be appreciated.
Answer by NeoKuro · Feb 06, 2015 at 06:43 AM
Solved it. My initial attempt at simply 'resetting' the screen with a black Quad failed for some reason. But after trying again this seemed to work.
By creating a quad (or texture) and setting the colour to black (or whatever other colour you wish to set the screen to) and moving it out the way, when the screen resolution is called I simply transform the position of the Texture/Quad to cover the canvas/screen, I then reload the level, and set the resolution to the newly chosen one, and reload my menu. The code below shows it in case anyone else has the same problem I did.
This seems to have worked fine, and can be repeated however many times the user wants.
public void ApplyResolutionChange (GameObject menu)
{
GameObject blank = GameObject.Find ("BlankScreen");
blank.transform.position = new Vector3 (0, 0, 100);
Application.LoadLevel (0);
Screen.SetResolution (resolutionX, resolutionY, isFullscreen);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613182532im_/https://answers.unity.com/themes/thub/images/avi.jpg)