Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

URP + Multiple Displays

Discussion in 'Universal Render Pipeline' started by dimitris_baud, Jan 27, 2020.

  1. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    Are multiple displays working for you on iOS in URP? I am trying by using the script provided by Unity for this but can't get it work in URP.

    I created a new Built-in Render Pipeline project on Unity 2019.3.0.5 (latest) for iOS and Multiple Displays with the above script works fine.

    I did the same for a URP project and I get black on the second screen. Is there any information on this or maybe on how Cameras are treated differently in URP to hopefully understand what is going on?

    EDIT: I am using Metal as the graphics API.
    EDIT 2: Found this bug that seems relevant.
    EDIT 3: This message appears when enabling AirPlay (when the display becomes available)
    EDIT 4: Tested Unity 2018.3.x it's the same, it works in the Built-in RP but is broken on LWRP 4.10.0

    Thank you.
     
    Last edited: Jan 27, 2020
  2. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    No matter what I try this doesn't work. It seems to me that all cameras are rendering to the main display, no camera can render to the 2nd display and I can't seem to find a way to control that.

    Even after calling
    Code (CSharp):
    1. secondDisplayCamera.SetTargetBuffers(Display.displays[1].colorBuffer, Display.displays[1].depthBuffer);
    the second camera is still rendering to the first display (0).

    I suspect this is not limited to iOS. Has anyone got multi-display working on URP in general?
     
  3. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    Has no one successfully used multiple displays with the Universal Render Pipeline? (bump!)
     
  4. dimitris_baud

    dimitris_baud

    Joined:
    Jan 15, 2018
    Posts:
    30
    For anyone else looking into this, the issue seems to be confirmed as a known issue here.
     
  5. IMTactica

    IMTactica

    Joined:
    Oct 16, 2019
    Posts:
    19
    Heya, I also would like to know if it's possible to use URP and use 2 displays set up. Any info regarding this subject?

    Thanks!
     
  6. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,623
    We are adding support for Camera.targetDisplay on iOS Metal (backporting to 2019 LTS).
    The fact that URP does not work with Camera.SetTargetBuffers is the issue with URP (so you need to report it elsewhere i guess)
     
  7. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Sorry to necro this thread but wanted to check with @Alexey what the status of this is..

    Camera.targetDisplay is semi-working in 2020.2 on iOS Metal URP (although the documentation still states that this doesn't work for iOS). I can get an iPad app with an external display connected to run the external display at a different resolution but after a short while get weird graphics errors in the Xcode log and my app crashes on the iPad.

    It would be good to know if this is something that is being actively worked on or I whether I should go back to using the standard render pipeline?
     
  8. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,623
    >>but after a short while get weird graphics errors in the Xcode log and my app crashes on the iPad.
    well, we cannot help you without a bug with repro project
     
    wxxhrt likes this.
  9. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Hi @Alexey I'll get some data together and post what I've run into in a new thread when I have some downtime, I've got a kind of workaround at the moment but it would be good to know if what I'm running into is reproducible.
     
  10. kolmichcreations

    kolmichcreations

    Joined:
    Sep 12, 2014
    Posts:
    10
    We experience this problem for a long time now. I just submitted a bug report containing unities URP Starter scene modified by one single Camera using Display2 as a target.

    We can reproduce this bug in 2021.1.0b10 and 2020.2.1f1, Xcode 12.4, IOS 14.4

    When building the URP Demo scene + second camera rendering to Display2 to an IPAD + connecting an external display over usb the memory will skyrocket randomly resulting in a crash as you can see on the attached screenshots.

    Our project depends on external Display and I really hope you can fix this asap.. Thank you!

    Michal
     

    Attached Files:

  11. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Hi Michal @kolmichcreations

    The following is what I found to be a workaround, maybe it will help you, I think the part that made it work for me was setting the second monitor output to turn on after unity had loaded everything else up.. I do this by tapping the iPad screen but I guess you could put it on a timer..

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. // Currently using both the ipad screen and the external screen results in out of memeory crashes,
    5. // BUt turning the ipad screen off and using the external screen is fien except seems to be stuck at 1920 x1080, still this is fine for me.
    6. public class MultiScreen : MonoBehaviour
    7. {
    8.  
    9.     // set the two cameras via the inspector
    10.     public Camera primaryCam;
    11.     public Camera secondaryCam;
    12.  
    13.     void Start()
    14.     {
    15.         // render the primary camera to the main display
    16.         secondaryCam.depth = primaryCam.depth - 1;
    17.         secondaryCam.enabled = false;
    18.         primaryCam.enabled = true;
    19.     }
    20.  
    21.     void Update()
    22.     {
    23.        
    24.         // only render the second display if it is attached and mouse is clicked
    25.         if (Display.displays.Length > 1 && !secondaryCam.enabled && Input.GetMouseButtonDown(0))
    26.         {
    27.             // set the second display's resolution
    28.             Display.displays[1].SetRenderingResolution(Display.displays[1].systemWidth, Display.displays[1].systemHeight);
    29.             Display.displays[0].SetRenderingResolution(256,256);
    30.  
    31.             // render the secondary camera to the second display
    32.             secondaryCam.targetDisplay = 1;
    33.             secondaryCam.enabled = true;
    34.         }
    35.        
    36.     }
    37. }
     
  12. kolmichcreations

    kolmichcreations

    Joined:
    Sep 12, 2014
    Posts:
    10
    Thank you for your help. I will try this.

    Since uniy is now promising to concentrate on bugfixes and provide more stable versions in future i really think unity has to fix this external display issues once and for all. We really need a stable and reliable version of this, no next workaround, no quickfix, no promises. Please unity just fix this!!! This problem is 100% reproduceable and the bug is well documented.

    Is here anyone from the unity team who can confirm/deny that this display crashes will be fixed in the upcoming 2021 version? The issue number i submitted is: 1321153.

    Thank you!
     
  13. makimono79

    makimono79

    Joined:
    Oct 21, 2016
    Posts:
    1
    Hello all,
    Just wanted to chime in to say our product is also severely affected by this exact issue. @Alexey is there any perpective for a fix? Any information will be hugely appreciated! Thank you!
     
  14. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,623
    Yep, i see it, will check it out this week.
    Just to clarify: initially the issue was about "no multidisplay on URP", and THIS was fixed and tested. The issue with "memory is growing" is totally new and i have never seen it; so yeah, we need to dig in
     
    wxxhrt likes this.
  15. kolmichcreations

    kolmichcreations

    Joined:
    Sep 12, 2014
    Posts:
    10
    Hey Alexey,

    Thank you very much! This is fantastic news and will help us a lot. We are struggling with external display problems for a long time now.

    Please make sure that following functionality is working:
    - External display can be connected and disconnected multiple times without crashes while displaying the correct content in the correct resolution. Just use the default unity scene for testing..
    - All SetTargetBuffer methods work correctly using external Displays without crashing
    - The Display.displays property will be correctly updated when connecting and disconnectiong external displays multiple times. (At the moment its updated when connecting an external display but its not updated when disconnecting it)

    Thank you so much!

    Best wishes, from cold vienna! :)

    Michal
     
    wxxhrt likes this.
  16. kolmichcreations

    kolmichcreations

    Joined:
    Sep 12, 2014
    Posts:
    10
    @Alexey,

    I was contacted by Dalius from your Customer QA Team. I wrote him like 3 Mails on 26.03.2021 but he is not repsonding now for two weeks. Any update on this topic?

    Best wishes,

    Michal
     
  17. kolmichcreations

    kolmichcreations

    Joined:
    Sep 12, 2014
    Posts:
    10
    I have still no answer or solution from Dalius. We even did a massive test on all our 24! devices to make it easier for you to find and fix this. You can see the results here: https://docs.google.com/spreadsheets/d/1FAnQ7pWIm-Je3MRgeTLPgLV0FTNxdUOY0qO8kxvKhVs/edit#gid=0. I also sent this to dalius 3weeks ago!!

    As you can see the crash occures on all latest generation devices having a usb-c port.

    So:
    - We delivered a reproduceable bugreport with the simplest possible testing scene. Your URP start scene
    - We delivered an exact list of devices where you can reproduce this.
    - I wrote about 6 emails and 6 forum posts on this topic.

    Unity, can you please answer me and tell me what is going on here?!? I'm using unity for 13years now and i have spent really LOTS of money on unity licenses. This is frustrating...
     
    wxxhrt likes this.
  18. Andy-StudioBuzzword

    Andy-StudioBuzzword

    Joined:
    Nov 26, 2012
    Posts:
    4
    I don't know if this will fix the issues you're seeing Michal but I've been seeing the same behaviour and I've managed to resolve it.

    After a lot of trial and error I created a new build in Unity 2021.1.13f1 which is stable with an external display.

    Under Build settings -> Other settings -> Rendering, I checked 'Metal write-only backbuffer'.

    Also under Build settings -> Other settings -> Configuration in the 'Active input handling' drop down I selected 'Input system package' and ensured that all of my EventSystem objects were configured to use the new Input System UI Input Module.

    Let me know if you'd like more info about my project settings but hopefully this will help!

    Cheers,

    Andy