public void ParentHasChanged()
{
if (mPanel != null)
{
// This code allows drag & dropping of widgets onto different panels in the editor.
bool valid = true;
Transform t = cachedTransform.parent;
// Run through the parents and see if this widget is still parented to the transform
while (t != null)
{
if (t == mPanel.cachedTransform) break;
if (!mPanel.WatchesTransform(t)) { valid = false; break; }
t = t.parent;
}
// This widget is no longer parented to the same panel. Remove it and re-add it to a new one.
if (!valid)
{
if (!keepMaterial || Application.isPlaying) material = null;
mPanel = null;
CreatePanel();
}
}
}
static public int ParentHasChanged(IntPtr l) { try { UIWidget self = (UIWidget)checkSelf(l); self.ParentHasChanged(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }