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

Question How could we show UIDocument on non-main display?

Discussion in 'UI Toolkit' started by RamType0, Nov 20, 2020.

  1. RamType0

    RamType0

    Joined:
    Sep 11, 2018
    Posts:
    67
    It seems that UIDocument is shown on main display when we don't assign target texture for its panel settings.
    But how could we show it on non-main display?
    We already have terrible multi display support on uGUI (layout broken while displays have different resolution, doesn't handles pointer events correctly) , and I'm feeling very sad about it.
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    771
    Multi display support will make it in the final release of UI Toolkit.

    Our goal is to be able to provide a preview of this and other related features early next year -- it will require using Unity 2021.1 though.
     
    JG-Denver and RamType0 like this.
  3. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    @antoine-unity
    Just checking on any progress on this. Multi-display support for the UI toolkit is one of the last pieces of the puzzle for my project so that I can have the UI on one monitor.

    Is this coming out soon or already out?
    Should I update to 2021.1 to use this?

    Would I be able to render to a texture instead as a workaround in the meantime?

    Thank you in advance.
     
  4. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    396
    This will be available in a future release. In the meantime, You can set a target texture in the panel settings then render the panel manually on your desired monitor.

    In the Package Manager window, install the Samples for the com.unity.ui package, then select the Window->UI Toolkit->Examples->Rendering->RenderTexture 3D to see an example of this is action.
     
    JG-Denver and RamType0 like this.
  5. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    Thank you so much @uMathieu! This example is perfect and I really appreciate the help. I also like how I can load the example and then save the scene to review how it is built.
     
    uMathieu likes this.
  6. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    One other question on UI Toolkit that might be a quick one.

    I want to put some render textures on my UI screen that are updating every frame.

    What is the best way to do with UI Toolkit? I see there is an Image element that isn't in the builder or is there a better approach?
     
  7. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    396
    You can set the style.backgroundImage to the renderTexture.

    The example at Window->UI Toolkit->Examples->Rendering->RenderTexture Background shows show one way to use this.
     
    RamType0 and JG-Denver like this.
  8. exprt

    exprt

    Joined:
    Mar 24, 2013
    Posts:
    4
    Is there any update of this plans? Currently using 2020.3, and still no multi-screen.
     
  9. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    Hi exprt, I have been successfully using UI Documents with multiscreen for a while, since at least summer last year. As Antoine said earlier, "it will require using Unity 2021.1 though". So I believe this issue is you will need to move up in versions to utilize this. Otherwise, a previous workaround I used to render it to a surface as described by @uMathieu above might work, but generally, the UI Toolkit is built for the more recent releases of Unity.
     
    antoine-unity likes this.
  10. exprt

    exprt

    Joined:
    Mar 24, 2013
    Posts:
    4
    Sorry, my bad, I checked the version wrong.
    Just updated to 2021.3.0f1, ui now displays on multiple targets.
    I also had to add EventSystem to the scene, without it UI Toolkit events works only on one display. Multi display in UI Toolkit should be (better) documented.

    There is another problem, fortunately it only exists in editor and play mode, not in build version:
    when using multiple displays with different resolutions, clicking on one display causes to rescale ui on all displays, regardless of panel scaling settings (currently set to scale to screen res, 1920x1080, width).

    multidisplay rescalling.gif
     
  11. griendeau_unity

    griendeau_unity

    Unity Technologies

    Joined:
    Aug 25, 2020
    Posts:
    247
    This looks like a real issue, seen in other threads too, please report it using Help -> Report a bug so that we get all the information. Thanks!
     
  12. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    858
    The problem, beautifully illustrated by @exprt in the GIF above, persists in 2022.2b13, both in Play and non-Play mode.

    Was it ever reported as a bug?
     
  13. pierre_10

    pierre_10

    Unity Technologies

    Joined:
    Apr 1, 2016
    Posts:
    33
    cecarlsen likes this.