johnny 5
johnny 5

Reputation: 20995

Unity How to change the Rendering Order of A canvas

I'm using unity 5.3 and I'm trying to change the Rendering Order of two overlayed cross platform controls which each reside in their own canvas.

In previous versions you could bring the window into focus using

GUI.FocusWindow(0);

However this does not work with the new system. I've also tried modifying the order in the editor window which has done nothing.

Does anyone know how I can move a control to be on top of the other?

Upvotes: 7

Views: 37172

Answers (2)

johnny 5
johnny 5

Reputation: 20995

After doing some research I found the proper way to change the Canvas Rendering Order. There is a property in the Canvas for the Sort Order, which is really the render order.

enter image description here.

Just as a note remember the controls you want to be on top should have a larger order than the control on bottom.

Upvotes: 23

Krzysztof Bociurko
Krzysztof Bociurko

Reputation: 4662

Order in the editor window should work here. Are you sure you're changing the order of elements inside one canvas element?

Note that the order of elements in the Canvas game object is the order everything is rendered in - so the last thing you have in canvas will be the last thing drawn, so it will be on top of everything.

Here's how it works: editor window with canvas ordering example

This is demonstrated with Unity 5.3.4, with much older Unity it can be different (there was a change of the way how children were enumerated somewhere in 5.0 or 5.1 AFAIK).

Upvotes: 9

Related Questions