我有三个监视器。我已经将Unity配置为从连接到我的主要游戏对象的三个单独的摄像头渲染三个显示器,Unity build可以在所有显示器上渲染。但是,显示器以错误的顺序和错误的分辨率呈现。
我尝试使用display .systemWidth和.systemHeight为三个显示器中的每一个使用.SetRendereingResolution(),但这似乎不能修复其中一个显示器,特别是我设置为纵向模式的显示器,无法正确呈现。更改我激活显示器的顺序不会更改它们出现在哪个物理显示器上。
这是我的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()
{
}
}这是一个snip of my monitor layout so that you can see screen resolution, orientation, and relative positioning和一个picture of what I see when it renders。cube is attached to the left most camera, the sphere the right most camera。
最左侧的摄影机渲染在中央显示屏上,最右侧的摄影机渲染正确,最中间的摄影机渲染在最左侧的显示屏上,但不采用纵向分辨率。
关于如何解决这个问题有什么想法吗?谢谢!
发布于 2019-06-12 23:49:47
我仍然不知道是否有可能让Unity render以纵向显示,但我是如何处理这个问题的,那就是编写一个Powershell脚本,将我的显示器更改为横向模式,然后启动项目构建。在场景中,我旋转了相机90*。现在它可以正确地显示在我的面向肖像的显示器上。
https://stackoverflow.com/questions/56537896
复制相似问题