--- a/VOID_EditorHUD.cs +++ b/VOID_EditorHUD.cs @@ -30,7 +30,6 @@ using KSP; using System; using System.Collections.Generic; -using System.Linq; using System.Text; using ToadicusTools; using UnityEngine; @@ -58,9 +57,12 @@ { if (this._vesselOverlays == null) { - this._vesselOverlays = (EditorVesselOverlays)Resources - .FindObjectsOfTypeAll(typeof(EditorVesselOverlays)) - .FirstOrDefault(); + UnityEngine.Object[] overlayObjs = Resources.FindObjectsOfTypeAll(typeof(EditorVesselOverlays)); + + if (overlayObjs.Length > 0) + { + this._vesselOverlays = (EditorVesselOverlays)overlayObjs[0]; + } } return this._vesselOverlays; @@ -116,9 +118,7 @@ public void ehudWindowFunc(int id) { - StringBuilder hudString = new StringBuilder(); - - SimManager.TryStartSimulation(); + StringBuilder hudString = Tools.GetStringBuilder(); if (this.core.LastStage == null) { @@ -192,6 +192,8 @@ } GUI.BringWindowToBack(id); + + Tools.PutStringBuilder(hudString); } public override void DrawGUI()