看Unity官网对Screen.SetResolution()解释和例子:
A resolution switch does not happen immediately; it will actually happen when the current frame is finished.
using UnityEngine;
public class ExampleScript : MonoBehaviour
{
void Start()
{
Screen.SetResolution(640, 480, true);
}
}
Another example:
using UnityEngine;
public class ExampleScript : MonoBehaviour
{
void Start()
{
Screen.SetResolution(640, 480, true, 60);
}
}
Another example:
using UnityEngine;
public class ExampleScript : MonoBehaviour
{
void Start()
{
Screen.SetResolution(800, 600, false);
}
}
See Also: resolutions property.
Unity官网的第一个例子就是640480分辨率下的全屏,第二个例子是以60hz的速率转化为640480的全屏(默认情况这个preferredRefreshRate=0);第三个例子是800*480分辨率但不全屏。
|