private GameObject GetSkillBarById(string id) { GameObject go = null; Transform trans = null; if (this.transform.parent == null) { return(go); } for (int index = 0; index < this.transform.parent.childCount; ++index) { trans = this.transform.parent.GetChild(index); if (trans == null) { continue; } go = trans.gameObject; SkillBar panel = go.GetComponent <SkillBar>(); if (panel != null && go.name == "SkillBar(Clone)") { if (id == panel.GetId()) { return(go); } } } return(null); }