切换屏幕分辨率。
将使用 width
x height
的分辨率。
如果不支持指定的分辨率,则使用最接近的分辨率。
If preferredRefreshRate
is 0 (default) Unity will switch to the highest refresh rate supported by the monitor.
If preferredRefreshRate
is not 0 Unity will use it if the monitor supports it, otherwise will choose
the highest supported one.
在 Android 上,如果设备运行的是 Honeycomb (OS 3.0/API 11) 或更高版本,
则 fullscreen
控制 View.setSystemUiVisibility() 的 SYSTEM_UI_FLAG_LOW_PROFILE 标志。
在 Windows 应用商店应用程序中,从 Windows 8.1 及更高版本才开始支持切换到非原始分辨率。
To set a specific full-screen mode on a desktop platform, use the method overload tht accepts the FullScreenMode parameter.
不会立即切换分辨率;将在当前帧结束后进行。
using UnityEngine;
public class ExampleScript : MonoBehaviour { void Start() { // Switch to 640 x 480 full-screen Screen.SetResolution(640, 480, true); } }
另一个示例:
using UnityEngine;
public class ExampleScript : MonoBehaviour { void Start() { // Switch to 640 x 480 full-screen at 60 hz Screen.SetResolution(640, 480, true, 60); } }
另一个示例:
using UnityEngine;
public class ExampleScript : MonoBehaviour { void Start() { // Switch to 800 x 600 windowed Screen.SetResolution(800, 600, false); } }
另请参阅:resolutions 属性。