public static void SetupGui() { //if(Mod.IsEnabled && Mod.IsGuiEnabled) if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" Setting up Gui panel."); try { parentGuiView = null; parentGuiView = UIView.GetAView(); if (guiPanel == null) { guiPanel = (LaneRemoverGUI)parentGuiView.AddUIComponent(typeof(LaneRemoverGUI)); if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" GUI Setup."); //guiPanel.Hide(); } isGuiRunning = true; } catch (Exception ex) { Helper.dbgLog("Error: \r\n", ex,true); } }
public static void RemoveGui() { if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" Removing Gui."); try { if (guiPanel != null) { //is this causing on exit exception problem? guiPanel.gameObject.SetActive(false); GameObject.DestroyImmediate(guiPanel.gameObject); guiPanel = null; if (Mod.DEBUG_LOG_ON) Helper.dbgLog("Destroyed GUI objects."); } } catch (Exception ex) { Helper.dbgLog("Error: ",ex,true); } isGuiRunning = false; if (parentGuiView != null) { parentGuiView = null; } //toast our ref to guiview }