- Home /
Unity 5.6.1 Multi display - Second monitor shows as black
Hello all, I've got an issue which might be from me overlooking something simple and my searches bring up older versions of Unity, so any help would be really appreciated.
Trying to run a multi-display setup, two cameras targeted to two displays. Followed the manual, ran the .exe with the "-multidisplay" CMD argument and I still encounter the second screen being set to black rather than the camera's buffer.
Am I missing something here? Did this is a blank project with the code below and attached a project.
public class CamScript : MonoBehaviour {
public int tgtDisp = 0;
void Start () {
if (Display.displays.Length > 1)
{
Display.displays[1].Activate();
}
GetComponent<Camera>().targetDisplay = tgtDisp;
}
}
A thought perhaps while I'm at work. Perhaps this was due to the main display being display 2?
Answer by Propagant · Jun 09, 2017 at 05:11 PM
Check the Main Cameras Target Display to Display 1.
In the example scene provided I've set the two cameras up to display 1 & 2 and inside Unity they appear fine. When I do a build and try to run it as as I said above it causes one black screen and one rendered screen.
Hi, I am having a similar problem. I create a Camera from script and assign my second monitor as target display.
mycam.targetDisplay = 1;
Display.displays[1].Activate();
mycam.enabled = true;
When I run the build, the Appication will be renderd on my second screen, but there is an additional black window on my first monitor. I am starting the build from cmd, using comandline:
start myUnityBuild.exe -multidsiplay
Has anyone found a solution / workaround to fix this?
$$anonymous$$ind regards
[Unity version: 2017.1.0p4, 64bit]
Answer by mich_mckellar · Jun 10, 2019 at 04:43 PM
Super old - but this is because the default screen in Unity is 0, not 1.
You need to set main camera to target screen 0, and the second camera to target screen 1. (0 index array basically!)