Inspections and quick-fixes for Unity code
Rider helps you write better code, faster.
Unity support in Rider ships with several inspections designed to help you find issues with your code before you run it.
A couple of examples:
- Colors defined via
UnityEngine.Color
,UnityEngine.Color32
, andColor.HSVToRGB
are highlighted in the editor. You can also press Alt+Enter on a color usage and choose Pick color from palette to open the color editor and modify the color visually. - Rider shows warnings for unknown scenes, tags, and layers.
- Empty event functions are shown as dead code, with a quick-fix to remove them.
- A quick-fix is suggested to create a serialized field from a usage of an unresolved symbol.
- Rider ensures that all of your event functions have correct signatures: it highlights incorrect signatures and offers a quick-fix to correct them.
- There are warnings when using an inefficient string literal comparison with the tag property, and a quick-fix to rewrite this as a call to
CompareTag
. - 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.
A full list f inspections and corresponding quick-fixes is available on our GitHub page.