JetBrains Rider 2021.2 Help

Refresh Unity Assets

By default, Unity is set to automatically refresh assets (you can change this in the Unity Editor with Unity Preferences | General | Auto Refresh). If you use Unity in conjunction with Rider, the auto-refresh is triggered in two cases:

  • when you focus the Unity Editor window,

  • by Rider, for example, when you save your project, run unit tests, or perform some other actions (see below).

Note that refreshing the assets may be time consuming as Unity recompiles the code on each refresh.

How Rider triggers Unity Editor auto-refresh

To save your time, Rider triggers the assets refresh in the background while you work. This is how the refresh is triggered:

  • You save a file or all files in the project (excluding autosave).

  • You add a new .cs file to the project.

  • You run unit tests.

  • You perform VCS pull.

  • You explicitly call the Refresh Unity assets action, for example, by clicking the Refresh Unity Assets button on the toolbar. This may be especially useful if you want to run the startup code in Unity.

If you do not want Rider to refresh assets, clear the Automatically refresh assets in Unity checkbox in File | Settings... | Languages and Frameworks | Unity Engine.

Refreshing assets in the play mode

Auto-refreshing assets is usually a great way to work, but it may be inconvenient in the play mode as the recompile may reset game data. Note that Rider does not refresh assets if Unity is in the play mode. Therefore, this may be the problem only when you focus the Unity Editor window after running the play mode from Rider. To solve this issue, in Unity Editor, in Unity Preferences | General | Script Changes While Playing*, specify how the auto-refresh should be done in the play mode:

  • Recompile and Continue Playing: may reset game data.

  • Recompile after Finished Playing: Recommended if you do not want the changes to affect the play mode.

  • Stop Playing and Recompile: stops the play mode and may reset game data.

Last modified: 16 November 2021