Unity Tools

来源:互联网 发布:怎样申请淘宝开网店 编辑:程序博客网 时间:2024/05/29 05:55

开发中便于观察Console的信息,常常会用到清理控制太的功能,而Unity并没有开放出来,在其他地方看到的用反射的方法调用:

  1. [MenuItem("XBDebug/ClearConsole %#c"false, 37)]  
  2. public static void ClearConsole()  
  3. {  
  4.     // This simply does "LogEntries.Clear()" the long way:  
  5.     var logEntries = System.Type.GetType("UnityEditorInternal.LogEntries,UnityEditor.dll");  
  6.     var clearMethod = logEntries.GetMethod("Clear", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);  
  7.     clearMethod.Invoke(nullnull);  
  8. }  

暂停:

     Debug.Pause();

 

0 0
原创粉丝点击