0
\$\begingroup\$

I have 2 screenspace canvases in my scene..

Canvas 2 has just the mouse pointer image on it, the canvas has a sort order of 10.

Canvas 1 has everything else on it, it has a sort order of 0.

The mouse pointer renders in front of everything on canvas 1, except for the dropdown list. which is pretty much the standard dropdown from the Create\UI\DropDown menu.

I didnt think it was possible for some things on one canvas to render on top of another, and some things to not. It obviously is! But how? What is going on? What do I need to change on the dropdown to make it render with the rest of the stuff on its canvas?

enter image description here

\$\endgroup\$
0
\$\begingroup\$

OK duh It appears the default dropdown list has its own canvas with a sorting order of 30000

Its very late, brain not work.

It seems the DropDown component generates this canvas at runtime, so you cant just set it to not override sorting.. Unless you want to write a script to find the canvas everytime someone clicks the dropdown..

I just set my mouse canvases sorting order to 30,001 .. That worked

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Just a little note: why is that number that huge? I HIGHLY doubt and hope that the project does not require 30.000 layers of UI. Might make sense to go through the project and figure out how many layers you really need (probably not more than 5 or 6). \$\endgroup\$ – iQew May 13 at 10:13
  • 1
    \$\begingroup\$ @iQew it’s not on layer 30,000. The number is just a priority within its layer. It’s handy to separate priorities by large numbers for a buffer, like Unity does with their script execution order, shader rendering queues, etc. \$\endgroup\$ – Ed Marty May 13 at 13:35
  • 1
    \$\begingroup\$ An alternative to setting the sort order to 30,001 would be to use a different sorting layer set to render higher than the default layer. Then you needn’t worry about the order at all. \$\endgroup\$ – Ed Marty May 13 at 13:37
  • 1
    \$\begingroup\$ Ah yes. If it were a camera-based canvas you could anyway \$\endgroup\$ – Ed Marty May 13 at 14:02
  • 2
    \$\begingroup\$ @iQew Look at shaders. Why are the geometry and alpha test render queues 450 apart? Do they really think people will need 449 different queues for rendering after geometry and before transparent cutout materials? Obviously not. Or look at script priorities. As soon as you add one to the list it gets priority 100 (or -100). Because then you have room to add more in between without worrying about going through and adjusting all the other ones every time. Same thing goes for Unity UI. It’s set at a huge number so most people, regardless of how they separate canvases, won’t have any problems. \$\endgroup\$ – Ed Marty May 14 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.