LoginSignup
8
6

More than 5 years have passed since last update.

unity > debug > Consoleのクリア

Last updated at Posted at 2015-08-14
動作確認
Unity 5.1.1-f1 on MacOS X 10.8.5

直近の表示だけわかりやすいようにするためコンソールのクリアをしたい。

以下のようにClearConsole()を用意してそれを使えばいい。

using UnityEditor;
...

    [MenuItem ("Tools/Clear Console %#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);
        clearMethod.Invoke(null,null);
    }

    public void CompareClick() {
        ClearConsole ();
        Debug.Log ("test1");
        Debug.Log ("test2");
    }
8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6