我们使用Unity开发桌面应用程序,之前我们使用的是Unity 4。现在我们已将项目升级到Unity 5(5.2.1)。我们在设置屏幕分辨率时遇到问题。我们在Unity 4中使用Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);
来设置分辨率并且工作正常,但在Unity 5中,Screen.currentResolution.width
没有给出正确的值。
Unity 5.2.1有什么新东西可能导致这种情况吗?
听起来你正在寻找:
http://docs.unity3d.com/ScriptReference/Screen-width.html http://docs.unity3d.com/ScriptReference/Screen-height.html
要么:
http://docs.unity3d.com/ScriptReference/Resolution-width.html http://docs.unity3d.com/ScriptReference/Resolution-height.html
如果您的播放器认为它在窗口模式下运行,目前的分辨率可能只会给您预期的结果?
http://docs.unity3d.com/ScriptReference/Screen-currentResolution.html
我有同样的问题,我只是用另一种方式修复它:
Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, true);
它对我有用(其他人没有)。