/// <summary> /// Add all child with same effect. /// </summary> private void AddPanelChild() { Transform tempTrans = this.transform; for (int index = 0; index < transform.childCount; ++index) { Transform child = tempTrans.GetChild(index); // Only added once. if (child.GetComponent <JCS_PanelChild>() != null) { continue; } JCS_PanelChild panelChild = child.gameObject.AddComponent <JCS_PanelChild>(); panelChild.PanelRoot = mPanelRoot; } }
/// <summary> /// Add the panel child to all panel child. /// </summary> private void AddPanelChild() { Transform tempTrans = this.transform; // loop through the child object and // add on to it. for (int index = 0; index < transform.childCount; ++index) { Transform child = tempTrans.GetChild(index); // Only added once. if (child.GetComponent <JCS_PanelChild>() != null || child.GetComponent <JCS_PanelRoot>() != null) { continue; } JCS_PanelChild panelChild = child.gameObject.AddComponent <JCS_PanelChild>(); panelChild.PanelRoot = this; } }