Skip to content
Matt Ellis edited this page Feb 20, 2019 · 10 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
Alternative non-allocating method available Warning 2018.3
Attribute is redundant when applied to this declaration type Dead code
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
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 '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.

You can’t perform that action at this time.