Skip to content
Matt Ellis edited this page Jun 8, 2018 · 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
Attribute is redundant when applied to this declaration type Dead code
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
ScriptableObjects must be instantiated with ScriptableObject.CreateInstance instead of new Warning
Use CompareTag instead of explicit string comparison Warning
Clone this wiki locally