检索控制台窗口中消息的当前数量。
返回控制台窗口中当前存在的错误、警告和日志消息的数量。
using UnityEngine; using UnityEditor;
public class Example : MonoBehaviour { [MenuItem("Example/Print Log Counts")] static void PrintLogCounts() { ConsoleWindowUtility.GetConsoleLogCounts(out int error, out int warning, out int log); Debug.Log($"Errors: {error}, Warnings: {warning}, Info: {log}"); } }