Hi,
I've got a scene not unlike Example 7 - there's a UIDraggablePanel containing a UIGrid of objects (I'll call these "items") which have a BoxCollider and a UIDragPanelContents, and then a selection of children which are sprites and labels. Additionally, elsewhere on the screen, I've got a number of sprites representing "slots". The idea is that when you click on an item in the draggable panel, it gets duplicated and positioned in an empty "slots" to show that you've selected the item. I thought that something like this would work:
NGUITools.AddChild(slotObjects[freeSlotIndex], selectedItemObject);
i.e. clone selectedItemObject, position the clone in the same place as the appropriate slotObject, and set the slotObject as the parent of the selectedItemObject. This works, but doesn't give the result I wanted or expected, since although the whole composite item is cloned, it gets broken apart. Only the root of the item ends up correctly positioned and parented. All of its child widgets get left behind and just sit in the top of the screen hierarchy, which obviously looks very wrong.
Am I missing something about how AddChild works? Is there an easy way to use it without breaking cloned composite objects apart? Or do I have to write some recursive function of my own to hold these objects together as I move them around in the hierarchy?