IEnumerator TransitionToCo(UIPage.PageType _eTo) { overlay.transform.SetAsLastSibling(); overlay.SetActive(true); if (currentPage != null) { currentPage.OnExit(); } yield return(new WaitForSeconds(0.75f)); GameObject _obj = Resources.Load <GameObject>("Screen/" + _eTo.ToString()); GameObject _loadedObject = Instantiate(_obj, this.transform); currentPage = _loadedObject.GetComponent <UIPage>(); currentPage.OnEnter(); }