ReSharper 2019.2 Help

Working with UE4 Projects

When you open an Unreal Engine project, ReSharper will automatically adjust all its features and actions so that they take into account the different aspects and conventions of Unreal Engine. For instance, auto-import and code analysis will respect includes of .generated.h files.

Most of ReSharper's UE features work unintrusively in the background but there are a few described in this topic, that provide some actions and configurations.

Before you start

If you have not already done so, make sure your Visual Studio copy is set up to work with an Unreal Engine project — here are detailed instructions in the Unreal Engine documentation.

At the very least we recommend that you disable Visual Studio squiggles as they often produce false positives in Unreal Engine projects — go to Tools | Options | C++ | Advanced | Code Analysis and set Disable Squiggles or Disable C++ Code Analysis Experience to True.

Disabling Visual Studio squiggles to get rid of false positives in Unreal Engine projects

Indexing Unreal Engine code

You can start typing or navigating through your UE4 project seconds after you open it because by default, indexing of the engine code (which constitutes the major part of a project) is performed in the background after non-engine code is parsed.

You can configure how the engine code is indexed on the Code Editing | C++ | Unreal Engine page of ReSharper options (Alt+R,,O): you can disable the background indexing in case you want to have all engine code indexed before you start, or if you notice any performance degradation, you can disable the indexing altogether by clearing the Index Unreal Engine source files.

When the indexing is enabled, you will have a number of features. For example, use any symbols from the engine and ReSharper will automatically add missing #includes, or find usages of engine classes — for example, TArray<T> — in the engine's code and study how they are used there.

If the indexing is disabled, ReSharper will still index header file names, which is very fast but it will let you have code completion for includes, for example, #include <unreal/SomeClassFromUnreal.h>. Once you include a header, its code will be indexed automatically, so you will have code completion and analysis for symbols from the included header.

Unreal Engine naming conventions

When developing UE4 projects, you are probably using Unreal Engine coding standard. ReSharper detects UE4 projects and automatically uses the UE4 naming convention rules when generating and analyzing code in these projects.

ReSharper: Applying UE4 naming conventions

Unlike the default naming ruleset, which you can configure on the Code Editing | C++ | Naming Style page of ReSharper options (Alt+R,,O), Unreal Engine naming conventions are not configurable. ReSharper uses special code inspections to detect violations of naming rules according to the Unreal Engine coding standard. These inspections suppress the current naming ruleset in UE4 projects. If you want to change the severity level or disable these inspections, you can find them under C++ | Unreal Engine on the Code Inspection | Inspection Severity page of ReSharper options (Alt+R,,O). You can also see the corresponding warning and will be able to disable the UE4 naming inspection on the Code Editing | C++ | Naming Style when a UE4 solution is open:

ReSharper: Applying UE4 naming conventions

UE4 reflection specifiers

ReSharper supports Unreal Engine reflection macros such as UCLASS, USTRUCT, UENUM, and so on, which are used to emulate reflection that is missing in the C++ language. These macros will be resolved and you will get completion suggestions for them even if your Unreal Engine project is not built.

ReSharper: Code completion for UE4 reflection specifiers

Quick Documentation (Ctrl+Q) and summary tooltips in code completion are also available for reflection macros.

ReSharper: Quick documentation for UE4 reflection specifiers

UE4 remote procedure calls support

When analyzing your code, ReSharper identifies UE4 remote procedure calls (RPCs) by Client, Server, and NetMulticast specifiers in the UFUNCTION declaration statements.

ReSharper checks whether UE4 RPCs have the corresponding required _Validate and _Implementation functions and will highlight the RPC if at least one of them is not found. You can press Alt+Enter on the highlighting to generate the missing implementation stubs.

ReSharper: UE4 remote procedure calls support

In the example above, the _Validate function is missing and ReSharper will generate the following stub for you:

bool AShooterCharacter::ServerEquipWeapon_Validate(AShooterWeapon* NewWeapon) { }

From RPCs, you can jump to their _Validate and _Implementation functions from the Navigate To Ctrl+Shift+G popup, or from the Alt+Enter menu as shown on the screenshot above.

It also works for BlueprintNativeEvent: when the corresponding specifier is passed in UFUNCTION, ReSharper can generate an _Implementation function for you, as well as navigate to it from the declaration.

You can use Rename and Change Signature refactorings on UE4 RPC functions calls — the related _Validate and _Implementation functions will be updated accordingly.

ReSharper C++: UE4. refactoring RPC function calls

Code inspections

In addition to hundreds of code inspections that check general aspects of C++ code, there are some inspections that are specific to Unreal Engine projects.

Unreal Engine (6 inspections)

Inspections in this category are specific to C++ code of Unreal Engine projects.

Inspection

ID EditorConfig property Default severity
Inconsistent UE4 Naming CppUE4CodingStandardNamingViolationWarning resharper_cpp_ue4_coding_standard_naming_violation_warning_highlighting Hint
Inconsistent UE4 UClass Naming CppUE4CodingStandardUClassNamingViolationError resharper_cpp_ue4_coding_standard_u_class_naming_violation_error_highlighting Error
Non-UProperty object member can be garbage collected at any time CppUE4ProbableMemoryIssuesWithUObject resharper_cpp_ue4_probable_memory_issues_with_u_object_highlighting Warning
Objects stored in non-uproperty member can be garbage collected at any time CppUE4ProbableMemoryIssuesWithUObjectsInContainer resharper_cpp_ue4_probable_memory_issues_with_u_objects_in_container_highlighting Warning
UFUNCTION macro call before declaration has no effect CppUFunctionMacroCallHasNoEffect resharper_cpp_u_function_macro_call_has_no_effect_highlighting Warning
UPROPERTY macro call before declaration has no effect CppUPropertyMacroCallHasNoEffect resharper_cpp_u_property_macro_call_has_no_effect_highlighting Warning
Last modified: 13 November 2019