You can start with watching this 3-minute video where Matt Ellis gives a short overview of JetBrains Rider features for Unity Development.
By default, when working with a Unity project in Rider, the Explorer window works in the Solution mode showing you only the Scripts part of a bigger Unity project. To see all the assets that constitute this project, you can switch the Explorer window to the Unity mode: you will see exactly the same project tree as in the Unity editor.
Control over Unity editor
To reduce the time you spend context switching between Rider and the Unity editor, some of the Unity editor's functionality is exposed directly in Rider on the Unity toolbar located in the top right corner.
The toolbar allows:
- Controlling play mode: The Play, Pause, and Step buttons correspond to the same buttons in the Unity editor and work in the exact same way.
- Refreshing the asset database: The Refresh button causes the Unity editor to import any newly added assets, and if necessary, compile the project and regenerate the solution files (which Rider will silently reload). This is useful when adding new files through Rider, either by refactoring and renaming a file, or by adding new C# script or shader via file templates. It is also really helpful when adding a new
.asmdefassembly definition file: create the file in Rider, save, click Refresh and Unity will generate a new project file that Rider will silently reload. Note that there is also an automatic refresh, which happens whenever a file is saved.
- Accessing important Unity-related actions using the Unity-related Actions drop-down list:
- Unity Plugin Settings...: quickly open the Unity plugin settings page.
- Show Unity Log Window : open the log viewer.
- Switch to Full UI / Switch to Minimized UI: switch between the full Rider UI and the minimized one (all UI elements that are not related to Unity are hidden).
- Attach to Unity Process...: attach to the running Unity instance e.g. for debugging or unit testing purposes. You can also run this action in the main menu .
- JetBrains Rider marks classes, methods and fields that are implicitly used by Unity directly in the editor.
UnityEngine.Color32colors are highlighted, and hitting Alt+Enter will open the colour palette editor to modify the color. Also named colours and
- You can generate event functions using Unity Event Functions the Generate Code menu (Alt+Insert). This action is also available from Alt+Enter on a Unity-based class' name.
- Auto-completion will suggest event function names when declaring methods in Unity-based classes, and expand to include method signature. Simply start typing an event function within a class deriving from a known Unity class, such as
- Descriptions for event functions and parameters in Unity based classes are shown in tooltips and Quick Documentation.
Inspections and quick-fixes
- When the Solution-Wide Analysis is enabled, JetBrains Rider understands implicitly used fields and event functions and do not highlight them as not accessed.
- Empty event functions are shown as dead code, with a quick-fix to remove them.
- Using the
SyncVarAttributeinside any class other than
NetworkBehaviouris treated as an error.
- A quick-fix is suggested to create a serialized field from a usage of an unresolved symbol:
- JetBrains Rider ensures that all of your event functions have correct signatures: it highlights incorrect signatures and offers a quick-fix to correct them:
- JetBrains Rider warns you against using an inefficient string literal comparison with the
tagproperty, and provides a quick-fix to rewrite this as a call to
- JetBrains Rider warns you if you try to use the
newkeyword to create a new instance of a class deriving from
ScriptableObject. A quick-fix is suggested to use
- There are also inspections for the
[InitializeOnLoadMethod]attributes, ensuring that they have the correct method or constructor signatures, and JetBrains Rider will grey out a redundant
[InitializeOnLoad]attribute if the class doesn't have a static constructor, with a quick-fix to either quickly remove the attribute, or create the constructor.
- and more...
- Treating code marked with attributes from UnityEngine.dll, UnityEngine.Networking.dll and UnityEditor.dll as implicitly used.
Debug.Assertmarked as assertion method to help null-value analysis (e.g. "value cannot be null" after
Debug.Assert(x != null)).
LogFormat, etc. gets string formatting helper functionality.
Assertions.Assertmethods marked as assertion methods to help null-value analysis.
EditorTestsWithLogParser.ExpectLogLineRegexgets regular expression helper functionality.
- Various attributes now require the class they are applied to derive from a specific base type. E.g.
[CustomEditor]requires a base class of
- Support for Unity 2017.2's modularised UnityEngine assemblies.
Support for .shader files
JetBrains Rider provides the initial support for ShaderLab syntax in
.shader files, with limited support for Cg/HLSL blocks.
- Syntax and syntax error highlighting for ShaderLab syntax. Note that you can change the default color scheme in .
- Color Assistance:
- JetBrains Rider provides simple completion based on words found in the current file.
- Brace matching and highlighting, comment/uncomment (Ctrl+Alt+/), and to-do explorer support.
- Code folding.
- [Cg/HLSL] Syntax highlighting for
- [Cg/HLSL] Simple word based completion in Cg/HLSL blocks.
Support for assembly definition files
Assembly definition files (.asmdef) are used to separate project scripts into multiple assemblies in order to reduce compilation time. Unity will rebuild only required assemblies when you make changes in a script.
Rider provides support for .asmdef files: JSON schema validation, code completion, Find Usages, Rename refactoring, Navigation on references elements, and inspections/quick-fixes for self-reference and file name/assembly name mismatch.
JetBrains Rider offers a couple of Unity-specific live templates:
- sprop: a Unity property with a serialized backing field.
- sfield: a Unity serialized field.
- JetBrains Rider offers a number of file templates for new C# script, tests, and shader files:
When Rider is connected to the Unity editor, the Unity tool window becomes available. To open the window, select on the main menu or use the Unity-related Actions drop-down list on the Unity toolbar.
The Log tab of the Unity tool window brings Unity's Console into Rider. The tab shows Unity log entries and is updated as events are logged in Unity.
The Output part of the window on the right shows the content of the currently selected log entry. Rider makes the content interactive, so that you can navigate to any source file, class, method or property mentioned in the log entry.
Note that log entries can be filtered by event type: events from play or edit mode, warnings, errors, and messages.