Reputation: 33
We are using Unity to develop a desktop application, and we were using Unity 4 previously. Now we have upgraded our project to Unity 5 (5.2.1). We have an issue with setting the screen resolution. We used Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);
in Unity 4 to set the resolution and it works fine, but in Unity 5, Screen.currentResolution.width
doesn't give the correct value.
Is there anything new with Unity 5.2.1 that could cause this?
Upvotes: 2
Views: 2515
Reputation:
I had the same problem and I just fixed it by using another way:
Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, true);
It worked for me (the others didn't).
Upvotes: 0
Reputation: 418
It sounds like you're looking for either:
http://docs.unity3d.com/ScriptReference/Screen-width.html http://docs.unity3d.com/ScriptReference/Screen-height.html
Or:
http://docs.unity3d.com/ScriptReference/Resolution-width.html http://docs.unity3d.com/ScriptReference/Resolution-height.html
Current resolution might only give you what you expect if your player believes that it's running in Window mode?
http://docs.unity3d.com/ScriptReference/Screen-currentResolution.html
Upvotes: 2