public static void Startup() { // 自定义日志处理实例 if (string.IsNullOrEmpty(LogFilePath)) { LogFilePath = GenDefaultLogFilePath(); } try { s_writer = new DebugWriter(LogFilePath); } catch (Exception e) { Debug.LogWarning("文件操作失败 " + e.ToString()); if (s_writer != null) { s_writer.Dispose(); } return; } Application.logMessageReceived -= LogCallback; Application.logMessageReceived += LogCallback; Application.logMessageReceivedThreaded -= LogCallback; Application.logMessageReceivedThreaded += LogCallback; }
public static void Release() { if (s_writer != null) { s_writer.Dispose(); } s_writer = null; }