Keyboard shortcuts to open first console error

My workflow is as follows, but I’d like to replace all mouse usage with the keyboard.

  • Write code in MonoDevelop
  • Alt tab to Unity3D, watch it pause while building
  • Double click on any errors
  • Alt tab back to MonoDevelop

I’d like to be able to press a key or two to replace that third step. I tried to ctrl + shift + c, but it appeared to do nothing when the console was already open.

If that is not possible, my next option is to use AutoHotKey or something similar to do it for me.

Maybe I should be looking to build from MonoDevelop or Visual Studio, so I can take advantage of their configurable keyboard settings?

Here you go:

[MenuItem ("Edit/Clear Console %&c", false, 1)] // CMD + ALT + C
	static void ClearConsole () {
		var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll");
		var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
#if UNITY_5
		var doubleClickErrorIndexMethod = logEntries.GetMethod("RowGotDoubleClicked", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
#elif UNITY_4_6
		var doubleClickErrorIndexMethod = logEntries.GetMethod("OpenEntryFile", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
#endif
		clearMethod.Invoke(null,null);
		doubleClickErrorIndexMethod.Invoke(null, new object[]{0});
	}

I created a menu item with a shortcut [CMD+ALT+C] to call, using reflection, some internal Unity Editor methods related to the the console log. This will first clear the console, and then if there is an error present, will call the method to open MonoDevelop to the location of the first error. I only had information on hand about the internal methods in 4.6 and 5. As with any internal classes, these are likely to change with new updates, and may be different before 4.6. You may have to do some more investigation of your own if you aren’t on one of these 2 versions.