// WL800_Console.cs — 콘솔의 에러/경고 총 개수를 센다 (읽기 전용) // unity command run_script --file AgentScripts/WL800_Console.cs --entry WL800_Console.Count // // 왜 리플렉션인가: UnityEditor.LogEntries 는 internal 이고, CLI 의 get_console_logs 는 // 최근 100건만 돌려주므로 "전체 에러 0" 을 증명할 수 없다. using System.Reflection; using UnityEditor; public static class WL800_Console { public static object Count() { var t = typeof(Editor).Assembly.GetType("UnityEditor.LogEntries"); if (t == null) return "ABORT: LogEntries 타입 없음"; var m = t.GetMethod("GetCountsByType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); if (m == null) return "ABORT: GetCountsByType 없음"; object[] args = { 0, 0, 0 }; m.Invoke(null, args); return string.Format("콘솔 전체 — 에러 {0} / 경고 {1} / 로그 {2}", args[0], args[1], args[2]); } }