Skip to content
Matt Ellis edited this page Mar 26, 2020 · 12 revisions

Code Inspections

Unity support ships with several inspections designed to help you find issues with your code before you run it. The following pages provide more details about why Rider or ReSharper is showing a particular inspection.

Note that these pages can be navigated to from the Alt+Enter menu, under the "Inspection: …" sub menu, there will be a menu item "Why is Rider suggesting this?" or "Why is ReSharper suggesting this?". Selecting this item will navigate to the appropriate page in the list below.

Showing the 'Why is Rider suggesting this?' menu item
Inspection Default severity First introduced
Accessing multidimensional arrays is inefficient. Use a jagged or one-dimensional array instead Performance indicator 2020.1
Alternative non-allocating method available Warning 2018.3
Attribute is redundant when applied to this declaration type Dead code
'base.OnGUI()' will print "No GUI Implemented" in the Unity inspector Warning 2018.3
Camera.main is inefficient in frequently called methods Performance indicator 2018.2
Expensive method invocation Performance indicator 2018.3
Expensive null comparison Performance indicator 2018.3
MonoBehaviors must be instantiated with GameObject.AddComponent instead of new Warning
Order of multiplication operations is inefficient Performance indicator 2019.2
Possible mis-application of 'FormerlySerializedAs' attribute to multiple fields Warning 2018.2
Possible unintended bypass of lifetime check of underlying Unity engine object Warning
Redundant 'FormerlySerializedAs' attribute Dead code 2018.2
Redundant 'HideInInspector' attribute Dead code 2018.2
Redundant 'InitializeOnLoad' attribute Dead code
Redundant 'SerializeField' attribute Dead code
Redundant Unity event function Dead code
Repeated property access of built in component is inefficient Warning 2018.3
ScriptableObjects must be instantiated with ScriptableObject.CreateInstance instead of new Warning
Setting 'parent' property immediately after object instantiation is inefficient Warning 2018.3
String based type lookup is inefficient, use generic overload Warning 2018.3
String based property lookup is inefficient Warning 2018.3
Use CompareTag instead of explicit string comparison Warning

See also details on performance indicators and the performance critical context.

Clone this wiki locally