The canvas layout hierarchy relationship of Ugui (i.) _unity3d Ugui

Source: Internet
Author: User

One, the use of Ngui people know that the various Ngui sprite can be dept to the hierarchical management, in order to deal with the relationship between levels, and in the unity4.6 start Ugui, this is through the canvas to set the depth of the relationship between the

I designed three canvas in development to handle different types of UI messages

Staticcanvas

Touchormousecanvas

Buttoncanvas

1, Staticcanvas, the sort order I set to 0, I used to deal with some not used for touch screen and button (here is the mobile phone) the corresponding UI placement, such as the role of blood, magic value, bleeding hudtxt, the enemy's head of blood tips, etc.

2, Touchormousecanvas, the sort order I set to 1, is for the touch-screen response message set alone, such as through the touch screen to change the camera rotation, in the Touchormousecanvas directory to add a panel, Add an event Triger component, set its enent type to drag, and give it a specific message response function skill to achieve the touch screen control camera rotation.


3, Buttoncanvas, the sort order I set to 2, is used to handle a variety of button message response, the various buttons of the UI are placed in this

Attention:

These canvas render mode must be the same, and their sort order will work. As shown in the following figure



Second, Ugui components in addition to canvas is not inspector level set concept, the same root directory of components, is the root of the hierarchy relationship between the decision, who in the next, in the game and scene view, who will block who live.



Iii. Additional considerations when setting up a camera to individually render the layer layer of the UI

The following figure camera settings


Then canvas's render mode is set to screen Space-camera

Drag your own set of cameras to render camera

and canvas layer of layer to set up with their own camera culling mask the same, otherwise game vision will not see

Plane distance to be greater than 1 (0 to 1 is OK, but you have to adjust yourself to see in Game view), otherwise game view does not see

The culling mask of the UI camera above is the Uilayer layer

The following is a corresponding canvas screenshot


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.