Skip to content

Instantly share code, notes, and snippets.

@hrobertson
Last active March 1, 2023 16:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrobertson/f3a069e298381a6a47b559efad90d908 to your computer and use it in GitHub Desktop.
Save hrobertson/f3a069e298381a6a47b559efad90d908 to your computer and use it in GitHub Desktop.
Stardeus debugging in VSCode
  1. Check Unity version of Stardeus

Find [Stardeus install path]/UnityPlayer.dll and look at the version information. At time of writing it's Unity 2021.1.19

  1. If you don't already have the matching version of Unity Editor, download it from https://unity3d.com/get-unity/download/archive In this case, we need download 2021.1.19. Choose Unity Editor 64-bit.

  2. Make a backup of [Stardeus install path]/UnityPlayer.dll and [Stardeus install path]/Stardeus.exe

  3. After downloading extract the following files from [UnpackFolder]\Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win64_development_mono\

UnityPlayer.dll -> [Stardeus install path]/UnityPlayer.dll
WinPixEventRuntime.dll -> [Stardeus install path]/WinPixEventRuntime.dll
WindowsPlayer.exe -> [Stardeus install path]/Stardeus.exe
  1. Delete the downloaded Unity Editor files if you don't want them.

  2. Edit [Stardeus install path]/Stardeus_Data/boot.config:

wait-for-managed-debugger=1
player-connection-debug=1
  1. Install VSCode and the unity.unity-debug extension in addition to standard C# dev extensions eg:
  • unity.unity-debug
  • ms-dotnettools.csharp
  • fudge.auto-using
  1. Open your mod in VSCode and edit .vscode/mod.csproj. Change DebugType from none to portable

  2. Rebuild your mod

  3. Run [Stardeus install path]/Stardeus.exe then you will see a dialog with message "You can attach a managed debugger now if you want"

If you run it directly rather than through Steam, cancel the first dialog and wait for Steam to relaunch it and it'll show the dialog again.

  1. In VSCode, open the command pallet (Ctrl+Shift+P) and select Unity Attach Debugger.

My hostname is Study so I see two options like WindowsPlayer(Study).... Choose the one without the :0 suffix.

You can also add an entry to launch.json like:

{
  "name": "WindowsPlayer(Study)",
  "type": "unity",
  "request": "launch"
},
  1. Not working? If VSCode can't find any Unity processes, there's something preventing the debugger from recieving the multicast packets from the game. In my case disabling a virtual network adapter fixed it.

Happy debugging.

Note that breakpoints set in the [RuntimeInitializeOnLoadMethod] methods don't appear to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment