-
-
Notifications
You must be signed in to change notification settings - Fork 55
Debugging your mods in Visual Studio
piotrulos edited this page Mar 8, 2020
·
17 revisions
To start you need installed MSCLoader 0.4 or later, installed visual studio with unity debugger (if you install using tutorial on this wiki, you mostly have this, check if you have Debug > Attach unity debugger
option in VS menu)
- First you need to enable debugging in MSCPatcher. Open MSCPatcher and go to settings tab.
- Check that you understad what is debugging and press Enable Debugging
- Say YES to UAC prompt and in windows console screen press any key if prompted.
- You should get this message if everything you did right.
- Sometimes you need to restart your PC to get next step to work
- Set your project to
Debug
(remember to useRelease
when you ready to publish your mod)
- Compile your mod, and copy YourMod.dll and YourMod.pdb to mods folder.
- Run included
debug.bat
folder in your mods folder. - You can automate this process by using "post-build event command line" in visual studio
- Go to
Project > YourMod Properties...
(last option) then go toBuild Events
and in second window paste this:
- Go to
if "$(ConfigurationName)" == "Debug" (
copy "$(TargetPath)" "D:\Steam\steamapps\common\My Summer Car\Mods" /y
copy "$(TargetDir)$(TargetName).pdb" "D:\Steam\steamapps\common\My Summer Car\Mods" /y
cd "D:\Steam\steamapps\common\My Summer Car\Mods"
call "D:\Steam\steamapps\common\My Summer Car\Mods\debug.bat"
) ELSE (
copy "$(TargetPath)" "D:\Steam\steamapps\common\My Summer Car\Mods" /y
)
(Of course replace D:\Steam\steamapps\common\My Summer Car\Mods
with your Mods path.)
- You can automate this process further by using "Start browser with URL"
- Go to "Project > YourMod Properties..." (last option) then go to "Debug" under "Start Action" (at the top) go to "Start browser with URL" and paste this:
steam://rungameid/516750
- This will run the game after building and coping files to Mods directory.
- Now set some breakpoints run MSC and in VS go to
Debug > Attach Unity Debugger
- In new window click
Input IP
and type IP127.0.0.1:56000
(auto-filled IP should also work) and press OK
- Now play the game until you hit your breakpoint
- Now you can view variables and other values in real-time. To unfreeze game click continue in visual studio until you left all your breakpoints.
- How to install MSCLoader using MSCPatcher
- MSCPatcher explained
- How to install mods
- Official experimental linux support
- Unofficial tutorial for linux (wine/proton)
- Install Visual Studio for MSCLoader
- Install template for Visual Studio
- How to use templates
- Debugging your mods in Visual Studio
- Enable DevMode to help with debugging
- Uploading and creating Self update feature for your mod or reference
- All Playmaker Global Variables and Events
- How to create and use Asset Bundles