ManlyMarco / RuntimeUnityEditor

In-game inspector and debugging tools for applications made with Unity3D game engine
GNU General Public License v3.0
802 stars 98 forks source link

Clicking Log button - Start_shell Exception #4

Closed wh0am15533 closed 5 years ago

wh0am15533 commented 5 years ago

Clicking the Log button in Object Browser produces the following exception:

BepInEx Log: [Error : Unity Log] Win32Exception: The system cannot find the file specified.

Stack trace: System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) System.Diagnostics.Process.Start (System.String fileName) RuntimeUnityEditor.Core.ObjectTree.ObjectTreeViewer.DisplayControls () RuntimeUnityEditor.Core.ObjectTree.ObjectTreeViewer.WindowFunc (Int32 id) UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style)

Game Log file: [Debug:Runtime Unity Editor] [REPL] Found 286 public namespaces Uploading Crash Report Win32Exception: The system cannot find the file specified.

at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0 at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0 at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x00000] in :0 at System.Diagnostics.Process.Start (System.String fileName) [0x00000] in :0 at RuntimeUnityEditor.Core.ObjectTree.ObjectTreeViewer.DisplayControls () [0x00000] in :0 at RuntimeUnityEditor.Core.ObjectTree.ObjectTreeViewer.WindowFunc (Int32 id) [0x00000] in :0 at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in :0 at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in :0

(Filename: Line: -1)

wh0am15533 commented 5 years ago

In RuntimeUnityEditor.Core.ObjectTree.ObjectTreeViewer private void DisplayControls()

Change: if (GUILayout.Button("Log", new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { Process.Start(Path.Combine(Application.dataPath, "output_log.txt")); }

To This: if (GUILayout.Button("Log", new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { Process.Start(Application.consoleLogPath); }

EDIT: For now you have to do this in dnSpy since the source project is specific to the version of UnityEngine being used. In unity 2018 this fix will build. If you use pre 2018 UnityEngine.dll .consoleLogPath doesn't exist. It's would be great if this library could support dual mode detection and detect the correct dll to use. for example SceneManagement was moved to UnityEngine.Core.dll in newer versions so somethings fail even though they work if make changes in RuntimeUnityEditorCore.dll with dnSpy. Finally got a working build! But damn, alot of work needed for porting to different games. Now that I've got a working build from the master I'm intent on adding version detection, I'll let you know how it goes so if you want to merge eventually. I think this project has alot of potential.

Update: use Application.persistentDataPath that work in both versions.

wh0am15533 commented 5 years ago

Good fix Marco!