diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index f04c5dd5..1c5de260 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -22,6 +22,7 @@ public static class ConfigManager public static ConfigElement Default_Output_Path; public static ConfigElement DnSpy_Path; public static ConfigElement Log_Unity_Debug; + public static ConfigElement Log_To_Disk; public static ConfigElement Main_Navbar_Anchor; public static ConfigElement World_MouseInspect_Keybind; public static ConfigElement UI_MouseInspect_Keybind; @@ -121,6 +122,10 @@ private static void CreateConfigElements() "Should UnityEngine.Debug.Log messages be printed to UnityExplorer's log?", false); + Log_To_Disk = new("Log To Disk", + "Should UnityExplorer save log files to the disk?", + true); + World_MouseInspect_Keybind = new("World Mouse-Inspect Keybind", "Optional keybind to being a World-mode Mouse Inspect.", KeyCode.None); diff --git a/src/UI/Panels/LogPanel.cs b/src/UI/Panels/LogPanel.cs index 7a010b8a..ed70757b 100644 --- a/src/UI/Panels/LogPanel.cs +++ b/src/UI/Panels/LogPanel.cs @@ -73,7 +73,8 @@ private void SetupIO() File.Delete(files[i]); } - File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); + if (ConfigManager.Log_To_Disk.Value) + File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); } // Logging @@ -82,7 +83,7 @@ public static void Log(string message, LogType type) { Logs.Add(new LogInfo(message, type)); - if (CurrentStreamPath != null) + if (CurrentStreamPath != null && ConfigManager.Log_To_Disk.Value) File.AppendAllText(CurrentStreamPath, '\n' + message); if (logScrollPool != null)