Unity3D: 4.5.2f1
NGUI: 3.6.8
I am running a setup with 3 panels and cameras in my game. One each for Background, Game and Foreground (e.g. Dialogs). I have a prefab which I initially created on the Game Panel. Now I want to display the prefab in my Foreground-Panel. The prefab consists of labels, sprites, textures etc.
GameObject CardInstance = NGUITools.AddChild(target, (GameObject)Resources.Load("Prefabs/CardDisplay"));
This works as the card is displayed in the dialog on the right panel. "target" is a GameObject holding all objects in the dialog. Sadly I get a warning for each child widget:
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.
I tried to find a solution by myself, but the only thing that I found was the advice to use ParentHasChanged:
CardInstance.GetComponent<UIWidget>().ParentHasChanged();
That does not have any apparent effect. Traversing dozens of nested Gameobjects on the search for different NGUI elements to call that function on seems like overkill and is hopefully the wrong approach. How can I fix this issue?
Thanks in advance,
Patrick