public void HideUiWhenGameOver() { GameObject go = null; Transform ts = this.transform.Find("HeroPanel(Clone)"); if (ts != null) { go = ts.gameObject; } if (go != null) { HeroPanel heroPanel = go.GetComponent <HeroPanel>(); heroPanel.Hide(); } ts = null; go = null; ts = this.transform.Find("SkillBar(Clone)"); if (ts != null) { go = ts.gameObject; SkillBar skillBar = go.GetComponent <SkillBar>(); if (skillBar != null) { skillBar.Hide(); } } ts = null; go = null; ts = this.transform.Find("HeroChange(Clone)"); if (ts != null) { go = ts.gameObject; NGUITools.SetActive(go, false); } }