Last active
October 17, 2017 02:26
-
-
Save klkucan/361a2738dcb6af5fff950f0f5328d9bd to your computer and use it in GitHub Desktop.
UnityClearConsole in edtior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MenuItem("Tools/ClearConsole")] | |
private static void ClearConsole() | |
{ | |
#if UNITY_5 | |
var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll"); | |
var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public); | |
clearMethod.Invoke(null,null); | |
#elif UNITY_2017 | |
var assembly = Assembly.GetAssembly(typeof(SceneView)); | |
var type = assembly.GetType("UnityEditor.LogEntries"); | |
var method = type.GetMethod("Clear"); | |
method.Invoke(new object(), null); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment