C#
=> public static void SetResolution(int width, int height, bool fullscreen); C#
=> public static void SetResolution(int width, int height, bool fullscreen, int preferredRefreshRate = 0);
Description 描述
Switches the screen resolution.
切換屏幕分辨率。
A width by height resolution will be used. If no matching resolution is supported, the closest one will be used.
應用有寬高的分辨率,如果沒有匹配的分辨率被支持,將使用最接近的分辨率。
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.
如果preferredRefreshRate為0(默認),Unity將切換到顯示器支持的最高刷新率。如果preferredRefreshRate不是0,如果顯示器支持,Unity將使用它,否則將選擇支持的最高的一個。
In the web player you may only switch resolutions after the user has clicked on the content. The recommended way of doing it is to switch resolutions only when the user clicks on a designated button.
在網絡播放器,你只可以在用戶點擊內容之后切換分辨率。推薦的方法是只在用戶點擊一個指定的按鈕時切換分辨率。
On Android fullscreen controls the SYSTEM_UI_FLAG_LOW_PROFILE flag to View.setSystemUiVisibility(), on devices running Honeycomb (OS 3.0 / API 11) or later.
在Android全屏是控制SYSTEM_UI_FLAG_LOW_PROFILE到View.setSystemUiVisibility(),在Android系統3.0或更高版本的設備。
On Windows Store Apps, switching to non-native resolution is only supported starting from Windows 8.1 and newer.
在Windows Store Apps切換到非本地分辨率,僅支持Windows 8.1或更高版本。
A resolution switch does not happen immediately; it will actually happen when the current frame is finished.
全屏開關不會立即發生,在當前幀完成時它才實際發生。
// Switch to 640 x 480 fullscreen 全屏模式
Screen.SetResolution(640, 480, true);
// Switch to 640 x 480 fullscreen at 60 hz
Screen.SetResolution (640, 480, true, 60);
// Switch to 800 x 600 windowed 窗口模式
Screen.SetResolution (800, 600, false);