Tweaks to OnGUI and OnPostRender per sarbian's recommendation.
Tweaks to OnGUI and OnPostRender per sarbian's recommendation.

--- a/API/VOIDCore.cs
+++ b/API/VOIDCore.cs
@@ -73,16 +73,16 @@
 		public abstract event VOIDEventHandler onApplicationQuit;
 		public abstract event VOIDEventHandler onSkinChanged;
 		public abstract event VOIDEventHandler onUpdate;
-		public virtual event VOIDEventHandler onGui;
 		public virtual event VOIDEventHandler onPostRender;
+		public virtual event VOIDEventHandler onPreRender;
 
 		public virtual bool MethodInPostRenderQueue(VOIDEventHandler method)
 		{
-			if (this.onGui != null)
+			if (this.onPostRender != null)
 			{
 				ToadicusTools.Logging.PostDebugMessage(this, "Looking for method {0} in onGui", method);
 
-				foreach (var invoker in this.onGui.GetInvocationList())
+				foreach (var invoker in this.onPostRender.GetInvocationList())
 				{
 					ToadicusTools.Logging.PostDebugMessage(this, "Checking invoker {0}", invoker);
 
@@ -97,7 +97,6 @@
 		}
 
 		public abstract void OnGUI();
-		public abstract void OnPostRender();
 
 		public abstract void SaveConfig();
 

--- a/API/VOIDMaster.cs
+++ b/API/VOIDMaster.cs
@@ -107,16 +107,6 @@
 			this.Core.OnGUI();
 		}
 
-		public virtual void OnPostRender()
-		{
-			if (this.Core == null)
-			{
-				return;
-			}
-
-			this.Core.OnPostRender();
-		}
-
 		public virtual void OnDestroy()
 		{
 			if (this.Core == null)

--- a/API/VOID_Module.cs
+++ b/API/VOID_Module.cs
@@ -234,7 +234,7 @@
 
 			ToadicusTools.Logging.PostDebugMessage (string.Format("Adding {0} to the draw queue.", this.GetType().Name));
 			// RenderingManager.AddToPostDrawQueue (3, this.DrawGUI);
-			this.core.onGui += this.DrawGUI;
+			this.core.onPostRender += this.DrawGUI;
 		}
 
 		public virtual void StopGUI()
@@ -244,7 +244,7 @@
 				return;
 			}
 			ToadicusTools.Logging.PostDebugMessage (string.Format("Removing {0} from the draw queue.", this.GetType().Name));
-			this.core.onGui -= this.DrawGUI;
+			this.core.onPostRender -= this.DrawGUI;
 		}
 
 		public abstract void DrawGUI(object sender);

--- a/VOIDCore_Generic.cs
+++ b/VOIDCore_Generic.cs
@@ -320,8 +320,8 @@
 		public override event VOIDEventHandler onApplicationQuit;
 		public override event VOIDEventHandler onSkinChanged;
 		public override event VOIDEventHandler onUpdate;
-		public override event VOIDEventHandler onGui;
 		public override event VOIDEventHandler onPostRender;
+		public override event VOIDEventHandler onPreRender;
 
 		/*
 		 * Methods
@@ -530,18 +530,18 @@
 
 		public override void OnGUI()
 		{
-			Logging.PostDebugMessage(this, "In OnGUI");
-			if (this.onGui != null)
-			{
-				this.onGui(this);
-			}
-		}
-
-		public override void OnPostRender()
-		{
-			Logging.PostDebugMessage(this, "In OnPostRender");
+			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);
 			}
 		}
@@ -578,7 +578,7 @@
 			{
 				// RenderingManager.AddToPostDrawQueue(3, this.DrawGUI);
 				Logging.PostDebugMessage(this, "Adding DrawGUI to onGui");
-				this.onGui += this.DrawGUI;
+				this.onPostRender += this.DrawGUI;
 			}
 		}