You can ' t place widgets on a layer different than the uipanel that manages them.

Source: Internet
Author: User

Tribute to the original http://blog.csdn.net/chenggong2dm/article/details/39341823

When running a backpack made by Ngui, the newspaper warns:

"You can ' t place widgets on a layer different than the uipanel that manages them."
"If you want to move widgets to a different layer, the parent them to a new panel instead."

Point to open the code to see the source of Ngui, this is written:

[CSharp]View Plaincopy
  1. Public void Checklayer ()
  2. {
  3. if (panel! = null && panel.gameObject.layer! = gameobject.layer)
  4. {
  5. Debug.logwarning ("You can ' t place widgets on a layer different than the UIPanel that manages them.\n" +
  6. "If you want to move widgets to a different layer, the parent them to a new panel instead.", the This );
  7. Gameobject.layer = Panel.gameObject.layer;
  8. }
  9. }


Looked very simple, is to check whether the layer number is the same, if different, report a warning, and force the same layer.

Workaround :

1, if the items in the backpack are prefabricated, then ensure that the prefabricated layers (layer) are consistent with the backpack.

2, you can also use The_gameobj.layer = n in the code; (n is int) to dynamically maintain layer consistency.

You can ' t place widgets on a layer different than the uipanel that manages them.

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.