public void onUIDestroy() { UI = null; foreach (KSP.UI.Screens.CraftBrowserDialog dialog in GameObject.FindObjectsOfType(typeof(KSP.UI.Screens.CraftBrowserDialog))) { dialog.OnBrowseCancelled(); } foreach (GameObject go in GameObject.FindObjectsOfType <GameObject>()) { if (go.name == "CraftBrowser(Clone)") { Destroy(go); } } }
public IEnumerator waitOriginalDialog() { while (GameObject.Find("CraftBrowser(Clone)") == null) { if (waitCount < 30) { waitCount++; } else { needsFileReload = true; // Case when 'unsaved craft dialog' appears } yield return(null); } if (needsFileReload) { FetchShipFiles(); } needsFileReload = false; if (UI == null) { UI = gameObject.AddComponent <SMUI>(); } }