JetBrains Rider 2017.3 Help

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.
    unity editor icons
  • The UnityEngine.Color and UnityEngine.Color32 colors are highlighted, and hitting Alt+Enter will open the colour palette editor to modify the color. Also named colours and Color.HSVToRGB are supported.
    unity colors

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.
    unity generate event functions
  • 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.
    unity events autocomplete
  • Descriptions for event functions and parameters in Unity based classes are shown in tooltips and Quick Documentation.
    unity quickdoc

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 than NetworkBehaviour is treated as an error.
  • A quick-fix is suggested to create a serialized field from a usage of an unresolved symbol:
    unity serialized field
  • JetBrains Rider ensures that all of your event functions have correct signatures: it highlights incorrect signatures and offers a quick-fix to correct them:
    unity signature
  • 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 to CompareTag.
    unity comparetag
  • JetBrains Rider warns you if you try to use the new keyword to create a new instance of a class deriving from MonoBehaviour or ScriptableObject. A quick-fix is suggested to use gameObject.AddComponent<T>() or ScriptableObject.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 and UnityEditor.dll as implicitly used.
  • Marking Component.gameObject and Object.name as not-nullable.
  • Debug.Assert marked as assertion method to help null-value analysis (e.g. "value cannot be null" after Debug.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 of Editor.
  • 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:
    unity shader colors
  • JetBrains Rider provides simple completion based on words found in the current file.
    unity shader completion
  • Brace matching and highlighting, comment/uncomment (Ctrl+Alt+/), and to-do explorer support.
    unity shader todo
  • Code folding.
    unity shader folding
  • [Cg/HLSL] Syntax highlighting for CGPROGRAM/ CGINCLUDE blocks and .cginc files.
  • [Cg/HLSL] Simple word based completion in Cg/HLSL blocks.
    unity shader hlsl completion

Live templates

  • JetBrains Rider offers a number of file templates for new C# script, tests, and shader files:
    unity filetemplates
Last modified: 19 April 2018