void showLosePopUp() { GameObject parent = UICamera.first.transform.parent.gameObject; Debug.Log("PARENT NAME: " + parent.name); //Prefab GameObject obj = NGUITools.AddChild(parent, losePopUpPrefab); EscapeDeniedPopUp popup = obj.GetComponent <EscapeDeniedPopUp>(); }
IEnumerator EscapeDeniedPopUp() { yield return(new WaitForSeconds(0.8f)); //Do something GameObject parent = UICamera.first.transform.parent.gameObject; Debug.Log("PARENT NAME: " + parent.name); //Prefab GameObject obj = NGUITools.AddChild(parent, escapeDeniedPrefab); EscapeDeniedPopUp popup = obj.GetComponent <EscapeDeniedPopUp>(); }