The UIPanel of Ngui

Source: Internet
Author: User

Original: http://www.tasharen.com/forum/index.php?topic=6705.0

Overview

UIPanel is used to collect and manage the components of all the widgets under it. Create the actual draw call from the widget's geometry. Nothing can be rendered without a panel. If you're familiar with unity, you can think of UIPanel as renderer.



All panel has a depth value that affects all widgets it contains. If your UI has a lot of windows, it's best to have a panel for each window. The depth weights on the panel are much higher than the depth weights for each widget, so make sure the panel doesn't use the same depth. If you use the same depth on a panel, draw call is automatically split to guarantee the rendering order, so more draw call will be added.

  • The Alpha attribute affects all widgets under the panel. So you can use it to fade out the entire window.
  • If your UI needs to be affected by the light, you need to tick the Normals.
  • If you create a scrollable panel with many geometry, you need to tick the cull option to reduce the number of triangles. This can also degrade performance because the visibility of the widget needs to be checked every time the update is done.
  • Tick the static option to tell Ngui that the widget under this panel will not be moved, which can improve performance. Ngui will ignore all the position/rotation/scale changes. So moving widgets at runtime won't work-so be careful with them.
  • If you are debugging draw calls created by a panel, theShow all option may help you. You will see all draw call created by the Panel, sorted in render order. Each draw call will include details of its use to material, the widget's material, and even lets you close some draw call to ask for some questions.

Panel will automatically be based on dimensionsClip all of its child nodes. Use this feature to selectClipping any of the options in the drop-down list, and then adjust the size of the purple rectangle in Scene view, just as you would adjust the widget's size. By doing this you can put a panel in the scroll view and let him easily drag and drop.

Watch the clipping panel.cannot be nested. Each panel can only clip its own widgets, and if a panel is inside another panel, only one widget will affect the inside. This restriction will be removed later.

The default Ngui in the panel's render queues increases from 3000 onwards. You can passRender Q to modify. If you want to add particles to the middle of a two panel, just modify the render queue of the two panel one higher than the particle, one below the particle. If you want all draw call to use the same way as the Ngui 2.x version, use the z-axis instead of the depth. Then the render q to the panel is specified asExplicit. (NGUI 2.x is used for 3000).

If you look for andAnchors related documents, you can see the base class--uirect.

Tips

A kinetic rigidbody will automatically be added to your panel, as this will improve performance for unity. Moving a static collider will have a lot of performance-consuming operations, but moving the rigidbody will not.

The UIPanel of Ngui

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.