Tips & Tricks

ReSharper C++ 2019.1 for Unreal Engine: UE4 naming convention and completion for reflection specifiers

We’ve recently told you about a few major improvements in ReSharper C++ 2019.1 for those who develop games on Unreal Engine:

  • Part I: Performance improvements: faster cold startup times, better memory utilization, and new settings to tweak ReSharper’s indexing behavior
  • Part II: support for Remote Procedure Calls
  • Part III (today): Support for UE4 naming convention and completion for reflection specifiers

If you are making games based on Unreal Engine, grab this free build and give it a try. We want to hear your feedback, be it good or bad!


Unreal Engine naming convention

Naming rules is what helps code stay easy readable. When developers follow some common convention, it helps them quickly get the meaning of the code by just giving it a short glance. No surprise Epic Games gets a detailed document describing their current coding standards used across Unreal Engine code, including naming convention. And it’s recommended for game developers, who use UE4, to follow the same convention.

In ReSharper C++ we decided to simplify the task for the developers and integrated the Unreal Engine naming convention. Thus, when ReSharper C++ detects the UE4 project, it automatically applies the UE4 naming convention rules to its actions. Let’s take a look at a few samples.

Introduce Variable

Select an expression and call Introduce Variable refactoring. ReSharper C++ knows that for variables names should be capitalized, with no underscore between words:
Introduce variable

When introducing a boolean variable, the b prefix is used to create a new name:Introduce boolean

Generate getters and setters

You probably know ReSharper C++ can generate getters and setters for you (as well as constructors, various operators, hash and swap functions). If you have a boolean variable, UE4 naming guide recommends you name it with b prefix, but the getter should start with Is and remove the b prefix. So when generating a getter for such variable, ReSharper C++ will create the name according to these rules:
Boolean getter

In other cases, Get prefix will be suggested to you by default in getters and Set for setters.

Inconsistent naming inspection

This was about the newly created code, but how about the code that already exists and doesn’t follow the recommended UE4 naming guidelines? For this case, ReSharper C++ 2019.1 provides several Inconsistent UE4 naming inspections:

Naming inspection settings

They detect the names not matching the rules and suggest a quick-fix (which triggers a Rename refactoring):
Naming inspection

Completion for reflection specifiers

In ReSharper 2018.3 we’ve reworked our approach to UE4 reflection macros such as UCLASS, USTRUCT, UENUM, and so on – you no longer have to build your Unreal Engine project to resolve these macros correctly! And now we’ve moved forward and implemented a code completion for the reflection specifiers used in these macros:
Reflection specifiers completion


UPD. Rider for Unreal Engine Public Preview is now launched. Rider is already well known in the worlds of .NET and Unity game development and we are now ready to take on the world of Unreal Engine development! First-class C++ support, no compromises on IDE performance, knowledgeable about Blueprints, assists with the Unreal Engine reflection mechanism, understands HLSL – it’s all about Rider for Unreal Engine. Join the Early Preview now!

Your ReSharper C++ Team

image description