I ran into some problems related to this, so I wanted to raise the issue again.
void UpdateLayers ()
{
// Always move widgets to the panel's layer
if (mLayer != cachedGameObject.layer)
{
mLayer = mGo.layer;
NGUITools.SetChildLayer(cachedTransform, mLayer);
ResetAnchors();
for (int i = 0; i < drawCalls.Count; ++i)
drawCalls[i].gameObject.layer = mLayer;
}
}
NGUITools.SetChildLayer is entirely indiscriminate in which children have their layers changed, not just widgets. This seems to be a mistake, as certain setups can have a somewhat intricate setup of layers.
Personally, I'm running into problems with having to switch layers around during an animation and having inactive 3d elements inside the hierarchy in different layers. This makes the UIPanel screw up my layer setup since it completely blasé sets every child under it to a different layer. If you instantiate something with a panel inside it that is inactive, this method will also mess with the layering of that, which feels like a flaw.
Isn't the whole UpdateLayers redundant when the UIWidget has its own CheckLayer, which as far as I can see does the same thing?
For now I'm just commenting out the NGUITools.SetChildLayer since, as far as I can see, it's not needed anyway, I'm just loathe to change NGUI source without pull requesting it, so I just wanted to hear if there's some logic that I'm not seeing behind it.
