Menu items to log messages and clear the console
Custom menus are a great way to offer game developers easy access to your Editor Extension features. Logging actions is a good way to display and keep a record of actions performance and object properties that have been changed. In this recipe, we'll create a new menu for the Unity Editor application and a menu item that when selected logs a simple message:

How to do it...
To create a menu with a menu item to log messages to console, follow these steps:
- In the
Project
panel, create a new folder, Editor. - In your new
Editor
folder, create a new C# script-class namedConsoleUtilities.cs
, containing the following:
using UnityEditor; using UnityEngine; using System.Reflection; public class ConsoleUtilities : EditorWindow { [MenuItem("My Utilities/Clear Console")] public static void ClearLogConsole() { var assembly = Assembly.GetAssembly(typeof(SceneView)); var type = assembly.GetType("UnityEditor.LogEntries"); ...