我正在使用 Unity 5.4.1f1 个人版并进行 Windows 独立构建。我想在我的游戏中使用多个显示器。我有 2 个摄像头,并将其中一个摄像头的目标显示设置为显示 1,将第二个摄像头的目标显示设置为显示 2。
此外,我已经激活了显示,但在编辑器和构建上Display.displays.Length 始终为1。
所以它不会在第二个屏幕上显示任何内容。我应该怎么做才能在第二个屏幕上显示?
最佳答案
您需要使用 Display.Activate
激活代码中的每个附加显示。
参见the docs它说:
The best time to activate additional displays is upon creating a new Scene. A good way to do this is to attach a script component to the default Camera. Make sure you call Display.Activate only once during the startup. You may find it helpful to create a small initial scene to test it.
从示例中,在 Start()
方法中:
if (Display.displays.Length > 1)
Display.displays[1].Activate();
if (Display.displays.Length > 2)
Display.displays[2].Activate();
注意:监视器一旦激活,您就无法将其停用。
关于unity-game-engine - Unity 多显示器不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43066541/