public void ClearLevel() { // run when timelimit reach if (state == GameState.SCENE1) { // find all warpgate and set active to go to next level var objs = Resources.FindObjectsOfTypeAll(typeof(GoNextLevel)) as GoNextLevel[]; foreach (var item in objs) { item.gameObject.SetActive(true); } } else if (state == GameState.BOSS) { // boss state clear Debug.Log("Clear game Show Score..."); endGameUI.WinGame(); } }