Debugging Server Scripts
Summary
Debug running server scripts using Visual Studio.
Debugging Reactor in Visual Studio.
Server room/player/entity scripts are extacted from the project and built seperately in a KSServerRuntime solution. In order to step trough your server scripts with a debugger you must do the following:
Remember the name of the project you want to test. When you see
<PROJECT>
in the following instructions, replace that with the project name.Remember the name of the scene your want to test. When you see
<SCENE>
in the following instructions, replace that with the name of your scene.Remember the name of the room object your want to test. When you see
<ROOM>
in the following instructions, replace that with the room name.Open
./YourProject/Assets/ReactorScripts/Editor/Server/KSServerRuntime.sln
in Visual Studio. This is the project used to build the KSServerRuntime that includes your server scripts.
Only change the following settings. Changing other settings may result in a broken build. If this happens use CTR-F4 in Unity to rebuild your project.
Set the configuration options to Debug / AnyCPU
Open the KSServerRuntime project properties and select the Build Events tab. Add the following to the "Post-build event command line" options
copy $(TargetDir)KSServerRuntime.dll $(TargetDir)..\projects\<PROJECT>\KSServerRuntime.dll
copy $(TargetDir)KSServerRuntime.pdb $(TargetDir)..\projects\<PROJECT>\KSServerRuntime.pdb
Build the project with the debug configuration.
Open the KSServerRuntime project properties and select the Debug tab. Make the following changes
- Select "Start external program" and set the path to
<Project Path>/Reactor/Reactor.exe
- Change the "Working directory" to:
<Project Path>/Reactor/projects/<PROJECT>/
- Set the following Command line arguments
-id=1 -t=<ROOM> -s=<SCENE> config.json config.<SCENE>.json
You will now be able to step through your server scripts by clicking debug or F5 in KSServerRuntime project.
**Note that logs will be written to console instead of a log file while debugging