Unity编辑器:清空控制台(Console)

时间:2022-02-08 15:13:14
 static MethodInfo clearMethod = null;
/// <summary>
/// 清空log信息
/// </summary>
private static void ClearConsole()
{
if (clearMethod == null)
{
Type log = typeof(EditorWindow).Assembly.GetType("UnityEditor.LogEntries");
clearMethod = log.GetMethod("Clear");
}
clearMethod.Invoke(null, null);
}