Unity is a game-development platform used to create 2D and 3D games and deploy them on multiple platforms. JetBrains Rider provides powerful support for Unity including: Unity-specific quick fixes, context actions and inspections, code completion and syntax highlighting in shader files, debugging Unity scripts, and much more.
Supported versionsJetBrains Rider provides the support for Unity API versions 5.0 - 5.6, 2017.1 and later.
The support for Unity is based on two plugins:
- The open-source Unity Support plugin which provides the aforementioned feature set. The plugin comes bundled with Rider, so manual installation is not required.
- The additional Unity editor plugin which provides integration with the Unity Editor, namely sets Rider as the default script editor, ensures the C# solution and project files are up to date, and more. Rider will automatically add this plugin to all Unity projects that are opened. It will initially install the plugin to Assets/Plugins/Editor/JetBrains/Unity3DRider.cs, but will look for the file by name if it is moved. Normally, you should commit this file to your source control. Rider will automatically keep this file up to date, installing newer versions when available. You can disable this behaviour on.
To start using Rider with your Unity project
- Open an existing Unity project in the Unity Editor.
- Start Rider and open the .sln file of this Unity project. Rider will install the Unity editor plugin into the project.
- Switch back to the Unity Editor, with the same Unity project open. The new Unity editor plugin will automatically configure Rider as the external script editor.
This only needs to be done once, and can also be done manually, via the Unity Editor's External Editor Preference pane.
Double clicking on C# scripts and .shader files will now automatically open JetBrains Rider, load the solution and navigate to the file. The solution can be loaded directly with the menu item.
Adjusting auto-save settings
When a Unity project is opened, JetBrains Rider will check its own auto-save settings, and recommend changing behaviour to work better with Unity.
By default, JetBrains Rider will automatically save files when you switch to another application or when JetBrains Rider is idle. This is usually a great way to work, but it can have a negative impact with Unity projects, as it will cause a recompile which can reset game data if you are in play mode.
To prevent this, JetBrains Rider suggests disabling auto-save, so you have to be explicit about saving your files. Simply click the link in the notification, and JetBrains Rider will make the changes.