Search Unity

Multiscreen for iOS/Android?

Discussion in 'Android' started by aobjects, Jun 26, 2019.

  1. aobjects

    aobjects

    Joined:
    Jan 16, 2016
    Posts:
    10
    Hi everyone,

    We're trying to build an app that lets users display content on a second screen via (currently USB-C on Android and Lightning-HDMI adapter for iOS) and can't seem to find much information on if this is possible in Unity. We've tried to activate the second display like this:

    Code (CSharp):
    1.  
    2. void Update()
    3. {
    4.      if (!activated)
    5.      {
    6.          if (Display.displays.Length > 1 && cam.enabled)
    7.          {
    8.              Debug.Log("Display detected! Attempting to activate...");
    9.              activated = true;
    10.              var Rt = new RenderTexture((int)cam.pixelWidth, (int)cam.pixelHeight, 24, RenderTextureFormat.ARGB32);
    11.              cam.SetTargetBuffers(Display.displays[1].colorBuffer, Rt.depthBuffer);
    12.          }
    13.          cam.enabled = Display.displays.Length > 1;
    14.      }
    15. }
    Looking at ADB from Android, Display.displays.Length always returns as 1, preventing us from turning on the second screen. I found this forum post (https://forum.unity.com/threads/android-multiscreen-support.497076/) that asks about turning it on but unfortunately nothing is working :(

    Does anybody have any clues on where to go?
    Thanks
     
unityunity