ReSharper 2026.1 Help

Unity code inspections

ReSharper's code inspection features are also supported in Unity-specific C# code. You can find the detailed information on these features in the corresponding topics of the Find code issues with code inspection section.

Examples of code inspections and quick-fixes

  • ReSharper shows warnings for unknown scenes, tags, and layers.

  • When the Solution-wide analysis is enabled, ReSharper 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:

  • ReSharper ensures that all of your event functions have correct signatures: it highlights incorrect signatures and offers a quick-fix to correct them:

  • ReSharper 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.

  • ReSharper 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 ReSharper 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.

List of Unity-specific code inspections

Unity (47 inspections)

Inspections in this category report code issues specific to Unity projects.

Inspection
ID
EditorConfig property

Default severity

Alternative non-allocating method available


Unity.PreferNonAllocApi
resharper_unity_prefer_non_alloc_api_highlighting

Warning

Avoid 'base.OnGUI()' in classes derived from 'PropertyDrawer'


Unity.PropertyDrawerOnGUIBase
resharper_unity_property_drawer_on_gui_base_highlighting

Warning

Cannot resolve component or scriptable object


Unity.UnresolvedComponentOrScriptableObject
resharper_unity_unresolved_component_or_scriptable_object_highlighting

Warning

DOTS: IAspect fields are required to be one of the following types: RefRW, RefRO, EnabledRefRW, EnabledRefRO, DynamicBuffer, or Entity


Unity.Entities.AspectWrongFieldsType
resharper_unity_entities_aspect_wrong_fields_type_highlighting

Error

DOTS: Inconsistent type keywords


Unity.Entities.InconsistentModifiersForDotsInheritor
resharper_unity_entities_inconsistent_modifiers_for_dots_inheritor_highlighting

Error

DOTS: The type specified must be a structure type


Unity.Entities.MustBeStructForDotsInheritor
resharper_unity_entities_must_be_struct_for_dots_inheritor_highlighting

Error

Event function with the same name is already declared


Unity.DuplicateEventFunction
resharper_unity_duplicate_event_function_highlighting

Warning

Expected a type derived from 'Component' or 'MonoBehaviour'


Unity.ExpectedComponent
resharper_unity_expected_component_highlighting

Warning

Expected a type derived from 'ScriptableObject'


Unity.ExpectedScriptableObject
resharper_unity_expected_scriptable_object_highlighting

Warning

Field of 'ComponentLookup' type must be updated before being used.


Unity.Entities.NotUpdatedComponentLookup
resharper_unity_entities_not_updated_component_lookup_highlighting

Warning

File name should match the name of the assembly


MISMATCHED_ASMDEF_FILENAME
resharper_mismatched_asmdef_filename_highlighting

Suggestion

Group path is not defined


Odin.OdinUnknownGroupingPath
resharper_odin_odin_unknown_grouping_path_highlighting

Warning

Incorrect method signature


Unity.IncorrectMethodSignature
resharper_unity_incorrect_method_signature_highlighting

Warning

Incorrect Odin's group attribute type


Odin.OdinMemberWrongGroupingAttribute
resharper_odin_odin_member_wrong_grouping_attribute_highlighting

Warning

Member appears in multiple UI groups simultaneously


Odin.OdinMemberPresentInMultipleGroups
resharper_odin_odin_member_present_in_multiple_groups_highlighting

Warning

Method referenced in string literal does not have the expected signature


Unity.IncorrectMethodSignatureInStringLiteral
resharper_unity_incorrect_method_signature_in_string_literal_highlighting

Warning

'MonoBehaviour' instances must be instantiated with 'GameObject.AddComponent<T>()' instead of 'new'


Unity.IncorrectMonoBehaviourInstantiation
resharper_unity_incorrect_mono_behaviour_instantiation_highlighting

Warning

Parameter should be derived from 'Component'


Unity.ParameterNotDerivedFromComponent
resharper_unity_parameter_not_derived_from_component_highlighting

Warning

Possible incorrect application of attribute to multiple fields


Unity.PossibleMisapplicationOfAttributeToMultipleFields
resharper_unity_possible_misapplication_of_attribute_to_multiple_fields_highlighting

Warning

Possible unintended bypass of lifetime check of underlying Unity engine object (null coalescing on a type deriving from 'UnityEngine.Object' bypasses the lifetime check on the underlying Unity engine object)


Unity.NoNullCoalescing
resharper_unity_no_null_coalescing_highlighting

Disabled

Possible unintended bypass of lifetime check of underlying Unity engine object (null propagating on a type deriving from 'UnityEngine.Object' bypasses the lifetime check on the underlying Unity engine object)


Unity.NoNullPropagation
resharper_unity_no_null_propagation_highlighting

Disabled

Possible unintended bypass of lifetime check of underlying Unity engine object (pattern matching null checks on a type deriving from 'UnityEngine.Object' bypasses the lifetime check on the underlying Unity engine object)


Unity.NoNullPatternMatching
resharper_unity_no_null_pattern_matching_highlighting

Disabled

Prefer GUID-based assembly references


Unity.PreferGuidReference
resharper_unity_prefer_guid_reference_highlighting

Hint

Redundant attribute usage (attribute is redundant when applied to this declaration type)


Unity.RedundantAttributeOnTarget
resharper_unity_redundant_attribute_on_target_highlighting

Warning

Redundant attribute usage (redundant 'FormerlySerializedAs' attribute)


Unity.RedundantFormerlySerializedAsAttribute
resharper_unity_redundant_formerly_serialized_as_attribute_highlighting

Warning

Redundant attribute usage (redundant 'HideInInspector' attribute)


Unity.RedundantHideInInspectorAttribute
resharper_unity_redundant_hide_in_inspector_attribute_highlighting

Warning

Redundant attribute usage (redundant 'InitializeOnLoad' attribute)


Unity.RedundantInitializeOnLoadAttribute
resharper_unity_redundant_initialize_on_load_attribute_highlighting

Warning

Redundant attribute usage (redundant 'SerializeField' attribute)


Unity.RedundantSerializeFieldAttribute
resharper_unity_redundant_serialize_field_attribute_highlighting

Warning

Redundant Unity event function


Unity.RedundantEventFunction
resharper_unity_redundant_event_function_highlighting

Warning

Repeated access of property on built in component is inefficient


Unity.InefficientPropertyAccess
resharper_unity_inefficient_property_access_highlighting

Disabled

Scene does not exist


Unity.LoadSceneUnexistingScene
resharper_unity_load_scene_unexisting_scene_highlighting

Warning

Scene is disabled in the build settings


Unity.LoadSceneDisabledSceneName
resharper_unity_load_scene_disabled_scene_name_highlighting

Warning

'ScriptableObject' instances must be instantiated with 'ScriptableObject.CreateInstance<T>()' instead of 'new'


Unity.IncorrectScriptableObjectInstantiation
resharper_unity_incorrect_scriptable_object_instantiation_highlighting

Warning

Setting 'parent' property immediately after object instantiation is inefficient


Unity.InstantiateWithoutParent
resharper_unity_instantiate_without_parent_highlighting

Warning

Short scene name is not unique


Unity.LoadSceneAmbiguousSceneName
resharper_unity_load_scene_ambiguous_scene_name_highlighting

Warning

String based graphics property lookup is inefficient


Unity.PreferAddressByIdToGraphicsParams
resharper_unity_prefer_address_by_id_to_graphics_params_highlighting

Warning

String based lookup of component type is inefficient


Unity.PreferGenericMethodOverload
resharper_unity_prefer_generic_method_overload_highlighting

Warning

The index is missing in the build settings


Unity.LoadSceneWrongIndex
resharper_unity_load_scene_wrong_index_highlighting

Warning

The input name is not defined in the Input manager


Unity.UnknownInputAxes
resharper_unity_unknown_input_axes_highlighting

Warning

The layer is not defined in the 'Tags & Layers'


Unity.UnknownLayer
resharper_unity_unknown_layer_highlighting

Warning

The resource is not defined in the project


Unity.UnknownResource
resharper_unity_unknown_resource_highlighting

Warning

The same shortcut is defined for another menu item


Unity.DuplicateShortcut
resharper_unity_duplicate_shortcut_highlighting

Warning

The tag is not defined in the 'Tags & Layers'


Unity.UnknownTag
resharper_unity_unknown_tag_highlighting

Warning

There is no animator state with the same name in the project.


Unity.UnknownAnimatorStateName
resharper_unity_unknown_animator_state_name_highlighting

Warning

There is no scene with the same name in the build settings


Unity.LoadSceneUnknownSceneName
resharper_unity_load_scene_unknown_scene_name_highlighting

Warning

To use the result of a 'GetSingleton' call in the function, 'OnCreate' must include a 'RequireForUpdate' call


Unity.Entities.SingletonMustBeRequested
resharper_unity_entities_singleton_must_be_requested_highlighting

Warning

Use 'CompareTag' instead of explicit string comparison


Unity.ExplicitTagComparison
resharper_unity_explicit_tag_comparison_highlighting

Warning

Unity Burst Compiler Warnings (17 inspections)

Inspections in this category report warnings of the Unity Burst Compiler before the code is actually compiled.

Inspection
ID
EditorConfig property

Default severity

Accessing managed indexers is not supported


Unity.BurstAccessingManagedIndexer
resharper_unity_burst_accessing_managed_indexer_highlighting

Warning

Accessing managed methods is not supported


Unity.BurstAccessingManagedMethod
resharper_unity_burst_accessing_managed_method_highlighting

Warning

Boxing is not supported


Unity.BurstBoxingNotSupported
resharper_unity_burst_boxing_not_supported_highlighting

Warning

Burst: String.Format(format, ...) invalid argument type


Unity.BurstStringFormatInvalidArgument
resharper_unity_burst_string_format_invalid_argument_highlighting

Warning

Burst: The variable resolves to System.String, which may result in invalid managed method calls at the Burst-compiled call stack


Unity.BurstLocalStringVariableDeclaration
resharper_unity_burst_local_string_variable_declaration_highlighting

Suggestion

Creating a managed type is not supported


Unity.BurstCreatingManagedType
resharper_unity_burst_creating_managed_type_highlighting

Warning

Debug logging functions only accept strings


Unity.BurstDebugLogInvalidArgument
resharper_unity_burst_debug_log_invalid_argument_highlighting

Warning

Function signature cannot contain managed types


Unity.BurstFunctionSignatureContainsManagedTypes
resharper_unity_burst_function_signature_contains_managed_types_highlighting

Warning

Loading from a non-readonly static field is not supported


Unity.BurstLoadingStaticNotReadonly
resharper_unity_burst_loading_static_not_readonly_highlighting

Warning

Loading managed type is not supported


Unity.BurstLoadingManagedType
resharper_unity_burst_loading_managed_type_highlighting

Warning

Shared static type parameter requires the unmanaged constraint


Unity.SharedStaticUnmanagedType
resharper_unity_shared_static_unmanaged_type_highlighting

Warning

Some SharedStatic`1.GetOrCreate overloads cause compiler errors


Unity.BurstSharedStaticCreate
resharper_unity_burst_shared_static_create_highlighting

Warning

String.Format(format, ...) only accepts string literals and const strings


Unity.BurstStringFormatInvalidFormat
resharper_unity_burst_string_format_invalid_format_highlighting

Warning

The 'foreach' construction is not supported


Unity.BurstForeachNotSupported
resharper_unity_burst_foreach_not_supported_highlighting

Warning

Try statement is not supported


Unity.BurstTryNotSupported
resharper_unity_burst_try_not_supported_highlighting

Warning

Typeof is prohibited in Burst


Unity.BurstTypeofExpression
resharper_unity_burst_typeof_expression_highlighting

Warning

Writing to a static field is not supported


Unity.BurstWriteStaticField
resharper_unity_burst_write_static_field_highlighting

Warning

Unity Performance Inspections (5 inspections)

Inspections in this category report computationally inefficient patterns Unity projects.

Inspection
ID
EditorConfig property

Default severity

'Camera.main' is expensive


Unity.PerformanceCriticalCodeCameraMain
resharper_unity_performance_critical_code_camera_main_highlighting

Hint

Expensive method invocation


Unity.PerformanceCriticalCodeInvocation
resharper_unity_performance_critical_code_invocation_highlighting

Hint

Expensive null comparison


Unity.PerformanceCriticalCodeNullComparison
resharper_unity_performance_critical_code_null_comparison_highlighting

Hint

Order of multiplication operations is inefficient


Unity.InefficientMultiplicationOrder
resharper_unity_inefficient_multiplication_order_highlighting

Warning

Use jagged or one-dimensional array instead of multidimensional array


Unity.InefficientMultidimensionalArrayUsage
resharper_unity_inefficient_multidimensional_array_usage_highlighting

Warning

27 March 2026