JetBrains Rider 2019.2 Help

Profiling Unity Applications

JetBrains Rider comes with bundled performance profiler that allows finding performance bottlenecks in your Unity games. This includes finding slowest methods in your scripts, determining the cause of CPU starvation, blocking garbage collection, disk I/O, and other issues. The integrated profiler is based on JetBrains dotTrace and is compatible with Unity 2018.3 and later. You can use the profiler via the Performance Profiler tool window. For more details on the integrated profiler, refer to Performance Profiling of .NET Code.

Installation and licensing

dotTrace is provided as a bundled plugin for Rider, and installed along with Rider automatically with no additional actions needed. If for some reason you want to disable dotTrace, you can do this via Rider's Plugins settings.

Note that dotTrace is available in Rider only for the owners of ReSharper Ultimate + Rider or All Products Pack subscriptions.

How to profile a Unity application

There are two ways to profile a Unity application:

  • Profile a project opened in the Unity Editor: in this scenario, the profiler will restart the Unity Editor with profiling enabled. This is the most convenient way in case you need to profile the Unity project that is currently opened in the Unity Editor and Rider. The downside of this method is that you have to close the currently running Unity Editor instance.

  • Profile the Unity application executable: if you have a compiled Unity application executable, you can profile it without the need to restart the Unity Editor.

To profile a project opened in the Unity Editor and Rider

  1. On the toolbar, choose a run configuration: either Attach to Unity Editor or Attach to Unity Editor and Play.

  2. On the toolbar, choose the Timeline (Unity) profiling configuration.

  3. Run profiling by clicking the Profile Unity app Run 'Attach to Unity Editor' with 'Timeline (Unity)' button on the toolbar.

  4. Close the Unity Editor.

  5. Click the Profile Unity app Run 'Attach to Unity Editor' with 'Timeline (Unity)' button one more time. This will start a profiling session.

  6. Reproduce the performance issue you are looking for or, if you just evaluate the overall app performance, go through the desired usage scenarios in your application.

  7. Click Get Performance Snapshot Rider Get Snapshot. The collected snapshot will be added to the list of snapshots inside the Performance Profiler window. To start collecting profiling data again, click Start Recording Start Recording.

  8. After you collect a snapshot(s), you can finish the profiling session. Normally, you do it either by closing the profiled application or by detaching the profiler via the Detach profiler Detach button ( Kill processes Kill forcibly terminates the profiled app and the session, so, use it only in emergency cases).

  9. Analyze the collected snapshots.

To profile a Unity executable

  1. Create a new run configuration based on Unity Executable.

  2. Select this run configuration on the toolbar.

  3. On the toolbar, choose the Timeline (Unity) profiling configuration.

  4. Run profiling by clicking the Profile Unity app Run 'your_config' with 'Timeline (Unity)' button on the toolbar.

  5. Reproduce the performance issue you are looking for or, if you just evaluate the overall app performance, go through the desired usage scenarios in your application.

  6. Click Get Performance Snapshot Rider Get Snapshot. The collected snapshot will be added to the list of snapshots inside the Performance Profiler window. To start collecting profiling data again, click Start Recording Start Recording.

  7. After you collect a snapshot(s), you can finish the profiling session. Normally, you do it either by closing the profiled application or by detaching the profiler via the Detach profiler Detach button ( Kill processes Kill forcibly terminates the profiled app and the session, so, use it only in emergency cases).

  8. Analyze the collected snapshots.

Last modified: 17 September 2019