- Home /
UI not scaling correctly with screen resolution
When I run my game in the editor and change the resolution using the editor dropdown, everything works fine
(1280x800)
(720x450)
The window also resizes correctly when I build my game and exit fullscreen.
However, when I switch to fullscreen from ingame, the UI does not scale with the screen size unless I set the resolution to the native resolution. (not allowed any more pictures, sorry about link.)
Part of fullscreen/resolution change script:
void ChangeSettings () {
//...
StartCoroutine (Fullscreen (isFullscreen)); //isFullscreen = Player Pref
//...
}
private IEnumerator Fullscreen (bool fullscreen) {
int width = Mathf.FloorToInt (resolution.x); //Player pref resolution
int height = Mathf.FloorToInt (resolution.y);
Screen.fullScreen = fullscreen;
yield return new WaitForEndOfFrame ();
yield return new WaitForEndOfFrame ();
Screen.SetResolution (width, height, Screen.fullScreen);
}
I got this problem, if the OS resolution bigger than the game resolution on fullscreen. When I switch the windows resolution to 1280x720 and then start the game with a resolution of 1280x720 or 1920x1080, it works correctly
try to set custom anchor of parent panel of canvas and all underlying stuff...
Same here. It worked fine this morning before I updated Unity to 5.3. I've tried different "cheats". I've made a coroutine which switches the resolution, then disables/enables canvas scaler component, or change some parameters. I did it in hope that the changes will trigger it to "refresh". But it didn't help :(
Answer by wlad_s · Jan 20, 2016 at 02:05 PM
As karl.jones says here: http://forum.unity3d.com/threads/canvas-scaler-broken-in-unity-5-3-1f1.380809/
This is fixed in 5.3.1p3. http://unity3d.com/unity/qa/patch-releases