question

Farkas Szilard Levente avatar image
Farkas Szilard Levente asked

How to debug Unity Server based on GSDK sample?

Hello,

I was following the ReadMe for https://github.com/PlayFab/gsdkSamples/tree/master/UnityMirror sample.

The MockVmAgent is set up and I can run the server with the agent both as a container and as a process. Client connects fine and goes through authentication and login, disconnects when server is stopped.

When running as a process through MockVMAgent (with option "RunContainer": false), I tried to attach a debugger to the UnityServer executable but no breakpoints are hit. Breakpoints are ignored even if I build the UnityServer with the option to copy pdb files to the build folder and all other dev. options:

Clearly there must be a more straight forward way to debug the server, not clear from the documentation how to actually do it.

Looking at:

https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab

It's clear that you can test if a server launches and works correctly and that the container is fine to be published, but how does one debug the actual server code?

What I tried is:

1. Running as a container through MockVMAgent - I can't attach the debugger not sure how to do it, or if it can be done at all.

2. Running as a process through MockVMAgent - Can attach a debugger but breakpoints never hit, not even with pdb's are copied next to the server binary. Although a bit annoying to attach this way it would be acceptable if it would work.

3. Running through the editor (this would be a dream come true) - Gives error: "Environment variable GSDK_CONFIG_FILE not defined." - Is it even possible to run the server only from the editor without using MockVMAgent? If it is than how do I solve this GSDK_CONFIG_FILE error? Not asking how to define the environment variable, I'm asking for a documentation for the expected config file.

Thank you!

Custom Game Servers
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Farkas Szilard Levente avatar image Farkas Szilard Levente commented ·

Managed to solve point 2. I can debug and breakpoints are hit, but OnServerConnect is never called only OnReceiveAuthenticate and _connections is empty.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Farkas Szilard Levente commented ·

When running the server directly without the debugger, OnServerConnect gets called, is that correct? (You can view that from the log file)

0 Likes 0 ·
Farkas Szilard Levente avatar image Farkas Szilard Levente Citrus Yan commented ·

I will check and get back to you

0 Likes 0 ·
Show more comments

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.