JetBrains Rider 2020.2 Help

Debug Unity Applications

JetBrains Rider allows you to debug Unity game scripts using all the power of the debugger, including conditional and dependent breakpoints, watches, expression evaluation, and so on.

To debug a Unity application on a local computer

  1. Make sure the project you want to debug is opened in the Unity editor.

  2. In JetBrains Rider, open the corresponding Unity project solution.

  3. Set breakpoints by clicking the gutter next to a required line of code.

  4. Select the Attach to Unity Editor & Play run configuration.

  5. Start a debugging session by doing one of the following:

    • Click Debug on the toolbar.

    • Choose Run | Debug from the main menu.

    • Press Shift+F9.

To debug a Unity application on a remote device

  1. Make sure the project you want to debug is opened in a Unity player on the remote device.

  2. In JetBrains Rider, open the corresponding Unity project solution.

  3. Set breakpoints by clicking the gutter next to a required line of code.

  4. Make sure the Development Build and Script Debugging options are selected in Unity's Build Settings.

  5. Make sure the remote device is visible to the current network, and firewall rules allow incoming UDP messages for the current process.

  6. If you use an Apple USB device, make sure iTunes or the Apple Mobile Device service are installed.

  7. In the main menu, select Run | Attach to Unity Process.

  8. In the opened window, click Add player address manually and specify Host IP address and Port for connecting to the Unity player.

  9. Select the Unity process in the list and click OK.

  10. Run the application using the Play button in Rider or in the Unity player.

Note that when debugging a Unity application, the debugger shows some extra data for Unity objects. For example, when looking at a Scene in the debugger, you will now see a list of root game objects, and each GameObject will show child game objects and attached components. ECS Entity objects will also show component data.

Debug Unity applications

Using Unity pausepoints

A pausepoint is a new type of debugger breakpoint that does not suspend the execution of your code but instead pauses the Unity Editor at the end of the current frame. This lets you set a pause condition in the code (for example, hit a button, reach a certain health value, or just go down a certain code path) and then use the Unity editor's Inspector window to inspect the current state of the game. So, unlike a breakpoint, a pausepoint does not suspend the Unity editor.

To set a Unity pausepoint

  1. Set a breakpoint by clicking the gutter next to a required line of code.

  2. Right-click the breakpoint and in the context menu, choose Convert to Unity pausepoint.

    Unity Pausepoint

  3. Set an additional condition or a hit count for the pausepoint.

  4. Run debugging as usual.

  5. Once execution reaches the pausepoint, the Unity editor will switch to the pause mode letting you inspect the current state of your game or even change any values.

Last modified: 05 August 2020