How to sort 2 UI index?

I use loadSceneHierarchy to load 2 scene which only have ui, and i thout the last one will show upon the earlier one, but it does’n work !

From the forum i found someone said could use mutliple layers to make it, but i can’t understand, what is the layer of 2d UI?


Hi @fftidus,

UI elements are automatically sorted based on their position in the hierarchy when they belong to the same screen element.

I imagine in your case the two scenes end up creating two different screens. So yes the best solution here is to create a second UI layer and assign it to your second screen and to your active camera.

Go to your project settings and you will find a Layer panel, see the existing UI layer and create another one with the same settings. Make sure to add it after the default UI layer.

ok,i did it !!!

but i need to change every entity to my new Layer manual? Is there any way can set the Layer for all 2D screen children?

1 Like

The easiest way currently is to multi select the elements in the hierarchy by holding SHIFT key and selecting them, then in the inspector you can select the new layer.

Thank you for your reply ~o((≧▽≦o)

1 Like

I’ve a lot of UI’s in my game, I load them as an additional scene and destroy if no longer needed. So the las loaded is always at the bottom of hierarchy tree and so rendered at last and so visible… maybe thats an option?