NGUI 3.11.4
< NGUITools.cs >
static public GameObject AddChild (this GameObject parent, GameObject prefab, int layer)
{
var go = GameObject.Instantiate(prefab) as GameObject;
#if UNITY_EDITOR
if (!Application.isPlaying)
UnityEditor.Undo.RegisterCreatedObjectUndo(go, "Create Object");
#endif
if (go != null)
{
go.name = prefab.name;
if (parent != null)
{
Transform t = go.transform;
t.parent = parent.transform;
t.localPosition = Vector3.zero;
t.localRotation = Quaternion.identity;
t.localScale = Vector3.one;
if (layer == -1) go.layer = parent.layer;
else if (layer > -1 && layer < 32) go.layer = layer;
}
go.SetActive(true); <---------- What the hell !!!
}
return go;
}
It was never before!
Someone can bug hard!