How could we show UIDocument on non-main display?

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.

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.

2 Likes

@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.

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.

2 Likes

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.

1 Like

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?

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.

2 Likes

Is there any update of this plans? Currently using 2020.3, and still no multi-screen.

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.

1 Like

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).

8103755--1049042--multidisplay rescalling.gif

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!

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?

I reported the defect to the proper team. You can find it here: Unity Issue Tracker - [UI Toolkit] Rescale of the ui document when using multi display

1 Like