Unity在编辑器状态下清空控制台信息

public static void ClearConsole()
{
    var assembly = System.Reflection.Assembly.GetAssembly(typeof(UnityEditor.ActiveEditorTracker));
    var type = assembly.GetType("UnityEditorInternal.LogEntries");
    var method = type.GetMethod("Clear");
    method.Invoke(new object(), null);
}

 

出处:http://answers.unity3d.com/questions/578393/clear-console-through-code-in-development-build.html

 

Debug.ClearDeveloperConsole()也可以用,但稍麻烦些。

posted @ 2016-02-07 19:06  HONT  阅读(1886)  评论(0编辑  收藏  举报