public void Activate ();

描述

激活外部显示器。例如,连接到系统的辅助监视器。

函数 Activate() 将创建一个具有屏幕宽度和屏幕高度及默认刷新率的窗口。 此函数在 Windows、Linux 和 Mac 平台上可用。 默认主监视器的索引始终为 0。 辅助监视器的范围为 1 至 7。 在激活外部监视器前确保已将其连接。

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Check the number of monitors connected. if (Display.displays.Length > 1) { // Activate the display 1 (second monitor connected to the system). Display.displays[1].Activate(); } } }

public void Activate (int width, int height, int refreshRate);

参数

width此窗口的所需宽度(仅限 Windows。在 Linux 和 Mac 上,使用屏幕宽度)。
height此窗口的所需高度(仅限 Windows。在 Linux 和 Mac 上,使用屏幕高度)。
refreshRate所需刷新率。

描述

通过可用于 Windows 的此重载函数可指定所需的窗口宽度、高度和刷新率。

默认主监视器的索引始终为 0。 辅助监视器的范围为 1 至 7。 在激活外部显示器前确保已将其连接。

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Check the number of monitors connected. if (Display.displays.Length > 1) { // Activate the display 1 (second monitor connected to the system). Display.displays[1].Activate(0, 0, 60); } } }