Debugging in the Player

This is a guide on how to enable debugging in a standalone Unity Player.

Debugging a managed worker in a cloud deployment is not supported.

Before reading this guide, make sure you are familiar with:


1. Configure your worker

The .NET debuggers connect to your worker via a host and port combination. The Unity will only expose this port if you enable the Development and Allow Debug options for this worker. You can configure this via the build configuration asset.

  1. Find and open the instance of the build configuration asset in the Unity Editor Inspector.
  2. Expand the section for the worker type that you want to profile.
  3. Expand the Local Build Options section within that worker type.
  4. Select the tab that corresponds to the platform you would like to debug. For example, to run the worker on Windows, select Win x64 tab to configure the Windows build options.
  5. Ensure that both the Development and Allow Debug boxes are ticked.

2. Build the workers

Now that you've configured your worker to allow debugging, you can build your workers.

Select SpatialOS > Build for local > All workers from the Unity Editor menu to build all workers.

Alternatively, if you don't need to rebuild all the workers, you can only build the worker type for which you enabled the Development and Allow Debug options.

3. Start your worker(s)

In order to debug your worker, it must be running.

For example, if you wanted to debug a standalone UnityClient worker, you would select Spatial OS > Launch standalone client from the Unity Editor menu. Once launched, you will see this dialog:

Do not dismiss the dialog yet!

We need to attach the .NET debugger; follow the rest of the guide to see how!
Once the debugger is attached to the Unity process, click OK on this dialog.

4. Attach a debugger to the Unity process

JetBrains Rider

  1. Open Run > Attach Unity Process...
  2. Select the process that contains your game name and select OK.

Visual Studio

  1. Open Debug > Attach Unity Debugger
  2. Select the Project with your game name and click OK.

Rider/Visual Studio should now be attached to the Unity process and you can debug as normal.

Updated about a year ago


Debugging in the Player


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.