user9804443
user9804443

Reputation:

ScreenResolution is not being reset Unity

Hi guys my resolution upon running my newly build app is always 1920 x 1080 now I want to set it to 1280 x 720 fullscreen resolution . So what I did are this

PlayerSettings.defaultScreenWidth = 1280;
PlayerSettings.defaultScreenHeight= 720;

and also I set it on my Player Setting just to be sure

enter image description here

So here's how I find out that my resolution is not resetting

resolution.text = Screen.currentResolution.ToString();

Here's the solution I tried so far

1.) Screen.SetResolution

On this forum

Unity Forum. Where in tried also deleting the registry key in windows but that didn't work . I even tried also deleting the playerprefs but unfortunately that doesn't work also.

Could someone please help me with a remedy to this problem.

Upvotes: 0

Views: 2562

Answers (2)

Fay
Fay

Reputation: 122

If it's running windowed, according to Unity, Screen.currentResolution will return the current resolution of the desktop. So it'll show in your UI text 1920 x 1080 because of your desktop resolution. I just tried this and it worked fine:

void Awake() { Screen.SetResolution(1024, 768, true); // true for setting fullscreen as you wanted }

Also according to Screen.SetResolution, "a resolution switch does not happen immediately; it will actually happen when the current frame is finished".

Upvotes: 0

riciprini
riciprini

Reputation: 103

Try to change it from your Canvas

enter image description here

For fullscreen settings ,try to follow this guide: https://answers.unity.com/questions/48778/full-screen-mode.html

Upvotes: 1

Related Questions