Features
You can start with watching this 3-minute video where Matt Ellis gives a short overview of JetBrains Rider features for Unity Development.
Editor tips
- JetBrains Rider marks classes, methods and fields that are implicitly used by Unity directly in the editor.
- The
UnityEngine.Color
andUnityEngine.Color32
colors are highlighted, and hitting Alt+Enter will open the colour palette editor to modify the color. Also named colours andColor.HSVToRGB
are supported.
Event functions
- 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
MonoBehaviour
. - 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
SyncVarAttribute
inside any class other thanNetworkBehaviour
is 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
tag
property, and provides a quick-fix to rewrite this as a call toCompareTag
. - JetBrains Rider warns you if you try to use the
new
keyword to create a new instance of a class deriving fromMonoBehaviour
orScriptableObject
. A quick-fix is suggested to usegameObject.AddComponent<T>()
orScriptableObject.CreateInstance<T>()
instead. - There are also inspections for the
[InitializeOnLoad]
and[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.
External annotations
A lot of Unity-specific assemblies are annotated with External Annotations to improve code inspection when you make use of these assemblies.
- Treating code marked with attributes from
UnityEngine.dll
,UnityEngine.Networking.dll
andUnityEditor.dll
as implicitly used. - Marking
Component.gameObject
andObject.name
as not-nullable. -
Debug.Assert
marked as assertion method to help null-value analysis (e.g. "value cannot be null" afterDebug.Assert(x != null)
). -
Debug.AssertFormat
,LogFormat
, etc. gets string formatting helper functionality. -
Assertions.Assert
methods marked as assertion methods to help null-value analysis. -
EditorTestsWithLogParser.ExpectLogLineRegex
gets 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 ofEditor
. - 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.
- 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
CGPROGRAM
/CGINCLUDE
blocks and.cginc
files. - [Cg/HLSL] Simple word based completion in Cg/HLSL blocks.
Live templates
- JetBrains Rider offers a number of file templates for new C# script, tests, and shader files:
Last modified: 19 April 2018