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

在用NGUI做模块时。报了个这样的错误。

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, parent them to a new panel instead.

点进去看了下代码。

if (panel != null && panel.gameObject.layer != gameObject.layer)
		{
			Debug.LogWarning("You can't place widgets on a layer different than the UIPanel that manages them.\n" +
				"If you want to move widgets to a different layer, parent them to a new panel instead.", this);
			gameObject.layer = panel.gameObject.layer;
		}

从这里看错。是我们的对象的layer和panel的layer不一样。

解决方法如下;只需将对象的layer修改程和panel的一样即可。如下图

20141016094124

 

本文链接:

https://bobsong.cn/315.html
1 + 1 =
快来做第一个评论的人吧~