playMaker

Author Topic: Clear all of Unity's console with this, but how?  (Read 1232 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 824
Clear all of Unity's console with this, but how?
« on: January 03, 2022, 11:53:13 AM »
Code: [Select]
using UnityEditor;
 using System.Reflection;
 using System;
 
 public static class Utils {
     static MethodInfo _clearConsoleMethod;
     static MethodInfo clearConsoleMethod {
         get {
             if (_clearConsoleMethod == null) {
                 Assembly assembly = Assembly.GetAssembly (typeof(SceneView));
                 Type logEntries = assembly.GetType ("UnityEditor.LogEntries");
                 _clearConsoleMethod = logEntries.GetMethod ("Clear");
             }
             return _clearConsoleMethod;
         }
     }
 
     public static void ClearLogConsole() {
         clearConsoleMethod.Invoke (new object (), null);
     }
 }
Source

Once I place this clearConsoleMethod.cs script in a custom scripts folder, I should be able to call it from within Playmaker, yes?

« Last Edit: January 04, 2022, 05:11:23 PM by Broken Stylus »