Unity How to change the Rendering Order of A canvas

馋奶兔 提交于 2019-12-22 06:56:47

问题


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?


回答1:


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.

.

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




回答2:


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:

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



来源:https://stackoverflow.com/questions/37691592/unity-how-to-change-the-rendering-order-of-a-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!