Combine uGUI & UI Toolkit

Hello,
I had to combine old uGUI interface & new UI Toolkit dialogs, but meet the problem:
All mouse event go to uGUI elements and UI Toolkit gets mouse event only if no uGUI elements behind it (Rendering order is ok).
I wonder how to put UI Toolkit “in front” of uGUI Canvas in terms of mouse event processing ?

What is the render mode of you uGUI Canvas?

I tried Screen Space Overlay & Screen Space Camera - both don’t work.
Temporary I found solution - disable Graphic Raycaster component of Canvas object when show UI Toolkit dialog and enable back when close dialog. But I expect more elegant solution.

Did you try changing the sort order of the uitoolkit panel settings vs canvas?

1 Like

Yes I tried. Originally Canvas & UIDocument objects had UI Layer & Order == 0.
Setting UIDocument Order to 1 (or 2, 3,…) didn’t help.
And what I also found:

  • If Canvas Order == 0 and UIDocuments Order > 0 all mouse events go to Canvas and UIDocuments rendered in front of canvas
  • If Canvas Order > 0 and UIDocuments Order > 0 all mouse events go to Canvas and UIDocuments rendered behind canvas even UIDocuments Order > Canvas Order!

Looks like Order of UIDocuments doesn’t matter ! It always use 0 Order.

But after your mail I decided to check one stupid idea - if we can’t change Order for UIDocument from 0 may be Canvas Order == -1 help. So I set it to -1 and it WORKS!

So thank you very much for your reply.
And, please ask developers to fix that bug/“feature” with UIDocument to enable Sort Order management.

Could you go in Help > Report a Bug… and submit a bug report with a small repro of the issue? It would help a lot. Thanks

Be sure to look at the Panel Settings asset Sort Order, not the UI Document’s.
UI Document sort order sorts them inside a single panel. The Panels & Canvases are the ones that can get sorted together.

1 Like