UnityEssentials
Small but useful tools and features for Unity
EditorTweaks/Console.cs
Go to the documentation of this file.
1 #if UNITY_EDITOR
2 using System;
3 using System.Reflection;
4 using UnityEditor.ShortcutManagement;
5 using UnityEngine;
6 
7 namespace Essentials.EditorTweaks
8 {
12  public class Console
13  {
17  [Shortcut("Clear Console", KeyCode.Space, ShortcutModifiers.Action)]
18  public static void Clear()
19  {
20  Assembly assembly = Assembly.GetAssembly(typeof(UnityEditor.Editor));
21  Type type = assembly.GetType("UnityEditor.LogEntries");
22  MethodInfo method = type.GetMethod("Clear");
23  method?.Invoke(new object(), null);
24  }
25  }
26 
27 }
28 #endif