Probably got OnGUI subscriptions working right. Windows don't call DrawGUI infinity times anymore.
Probably got OnGUI subscriptions working right. Windows don't call DrawGUI infinity times anymore.

--- a/API/VOIDCore.cs
+++ b/API/VOIDCore.cs
@@ -73,8 +73,8 @@
 		public abstract event VOIDEventHandler onApplicationQuit;
 		public abstract event VOIDEventHandler onSkinChanged;
 		public abstract event VOIDEventHandler onUpdate;
+		public virtual event VOIDEventHandler onPreRender;
 		public virtual event VOIDEventHandler onPostRender;
-		public virtual event VOIDEventHandler onPreRender;
 
 		public virtual bool MethodInPostRenderQueue(VOIDEventHandler method)
 		{
@@ -82,21 +82,45 @@
 			{
 				ToadicusTools.Logging.PostDebugMessage(this, "Looking for method {0} in onGui", method);
 
-				foreach (var invoker in this.onPostRender.GetInvocationList())
+				foreach (Delegate invoker in this.onPostRender.GetInvocationList())
 				{
 					ToadicusTools.Logging.PostDebugMessage(this, "Checking invoker {0}", invoker);
 
 					if (invoker == method)
 					{
+						ToadicusTools.Logging.PostDebugMessage(this, "Found match.");
 						return true;
 					}
 				}
 			}
+			#if DEBUG
+			else
+			{
+				ToadicusTools.Logging.PostDebugMessage(this, "this.onPostRender == null");
+			}
+			#endif
+
 
 			return false;
 		}
 
-		public abstract void OnGUI();
+		public void OnGUI()
+		{
+			if (Event.current.type == EventType.Repaint || Event.current.isMouse)
+			{
+				if (this.onPreRender != null)
+				{
+					ToadicusTools.Logging.PostDebugMessage(this, "In OnGUI; doing 'pre draw' stuff");
+					this.onPreRender(this);
+				}
+			}
+
+			if (this.onPostRender != null)
+			{
+				ToadicusTools.Logging.PostDebugMessage(this, "In OnGUI; doing 'post draw' stuff");
+				this.onPostRender(this);
+			}
+		}
 
 		public abstract void SaveConfig();
 

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -88,6 +88,22 @@
 
 					return callback.GetInvocationList().Contains((Callback)this.DrawGUI);
 				}*/
+
+				using (var log = ToadicusTools.DebugTools.PooledDebugLogger.New(this))
+				{
+					log.AppendFormat("this.core: {0}\n", this.core != null ? this.core.ToString() : "null");
+					if (this.core != null)
+					{
+						log.AppendFormat("this.core.MethodInPostRenderQueue(this.DrawGUI): {0}\n",
+							this.core.MethodInPostRenderQueue(this.DrawGUI));
+					}
+
+					log.AppendFormat("this.GUIRunning: {0}\n",
+						this.core != null && this.core.MethodInPostRenderQueue(this.DrawGUI));
+
+					log.Print(false);
+				}
+
 				return this.core != null && this.core.MethodInPostRenderQueue(this.DrawGUI);
 			}
 		}
@@ -513,6 +529,11 @@
 
 		public override void DrawGUI(object sender)
 		{
+			if (this.core == null)
+			{
+				return;
+			}
+
 			GUI.skin = this.core.Skin;
 
 			Rect _Pos = this.WindowPos;

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -320,8 +320,6 @@
 		public override event VOIDEventHandler onApplicationQuit;
 		public override event VOIDEventHandler onSkinChanged;
 		public override event VOIDEventHandler onUpdate;
-		public override event VOIDEventHandler onPostRender;
-		public override event VOIDEventHandler onPreRender;
 
 		/*
 		 * Methods
@@ -525,24 +523,6 @@
 				{
 					((IVOID_BehaviorModule)module).FixedUpdate();
 				}
-			}
-		}
-
-		public override void OnGUI()
-		{
-			if (Event.current.type == EventType.Repaint || Event.current.isMouse)
-			{
-				if (this.onPreRender != null)
-				{
-					Logging.PostDebugMessage(this, "In OnGUI; doing 'pre draw' stuff");
-					this.onPreRender(this);
-				}
-			}
-
-			if (this.onPostRender != null)
-			{
-				Logging.PostDebugMessage(this, "In OnGUI; doing 'post draw' stuff");
-				this.onPostRender(this);
 			}
 		}