简体   繁体   English

使用Unity Multi-display,如何更改与Unity显示器关联的物理监视器?

[英]With Unity Multi-display how do I change which physical monitor is associated with a Unity display?

I have three monitors. 我有三台显示器。 I have configured Unity to render three displays from three separate cameras attached to my primary game object, and the Unity build does render on all displays. 我已将Unity配置为从附加到我的主要游戏对象的三个单独的摄像机渲染三个显示器,并且Unity构建确实在所有显示器上渲染。 However, the displays render in the incorrect order and in incorrect resolutions. 但是,显示以错误的顺序和错误的分辨率呈现。

I've attempted to .SetRendereingResolution() using the display .systemWidth and .systemHeight for each of the three displays, but this doesn't seem to fix that one of the displays, specifically the one I have set to portrait mode, doesn't render correctly. 我已经尝试为三个显示器中的每一个使用显示.systemWidth和.systemHeight来.SetRendereingResolution(),但这似乎无法解决其中一个显示问题,特别是我设置为纵向模式的问题。不能正确渲染。 Changing the order in which I activate the displays does not change which physical monitor they appear on. 更改我激活显示器的顺序不会改变它们出现在哪个物理监视器上。

Here's my DisplayScript.cs which is attached to my scene's main camera, and which activates the additional displays: 这是我的DisplayScript.cs,它已附加到场景的主摄像机上,并可以激活其他显示:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DisplayScript : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Debug.Log("displays connected: " + Display.displays.Length);
        // Display.displays[0] is the primary, default display and is always ON.
        // Check if additional displays are available and activate each.
        Display.displays[0].SetRenderingResolution(Display.displays[0].systemWidth, Display.displays[0].systemHeight);
        Display.displays[0].Activate();
        Debug.LogError("D0: Width " + Display.displays[0].systemWidth + " Height " + Display.displays[0].systemHeight);
        Debug.LogError("D1: Width " + Display.displays[1].systemWidth + " Height " + Display.displays[1].systemHeight);
        Debug.LogError("D2: Width " + Display.displays[2].systemWidth + " Height " + Display.displays[2].systemHeight);
        if (Display.displays.Length > 1)
        {
            Display.displays[1].SetRenderingResolution(Display.displays[1].systemWidth, Display.displays[1].systemHeight);
            Display.displays[1].Activate();

        }
        if (Display.displays.Length > 2)
        {
            Display.displays[2].SetRenderingResolution(Display.displays[2].systemWidth, Display.displays[2].systemHeight);
            Display.displays[2].Activate();
        }

    }
    // Update is called once per frame
    void Update()
    {

    }
}

Here's a snip of my monitor layout so that you can see screen resolution, orientation, and relative positioning , and a picture of what I see when it renders . 是我的显示器布局的一部分,因此您可以查看屏幕分辨率,方向和相对位置 ,以及渲染时看到图片 The cube is attached to the left most camera, the sphere the right most camera . 立方体连接到最左侧的相机,球体连接到最右侧的相机

The left most camera renders on the center display, the right most camera is rendering correctly, and the center most camera renders on the leftmost display, but does not assume a portrait resolution. 最左边的相机在中心显示屏上渲染,最右边的相机在正确渲染,最中心的相机在最左边的显示屏上渲染,但不采用纵向分辨率。

Any ideas as to how I can resolve this? 关于如何解决这个问题有什么想法吗? Thanks! 谢谢!

I still don't know if it's possible to make Unity render to displays in portrait orientation but how I handled the problem was writing a Powershell script to change my monitor to landscape mode and then launch the project build. 我仍然不知道是否可以将Unity渲染为纵向显示,但是我如何解决该问题是编写Powershell脚本将显示器更改为横向模式,然后启动项目构建。 Inside the scene I rotated the camera 90*. 在场景内部,我将相机旋转了90 *。 Now it displays appropriately on my portrait-oriented display. 现在,它可以正确显示在我的纵向显示器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM