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.
Select an expression and call Introduce Variable refactoring. ReSharper C++ knows that for variables names should be capitalized, with no underscore between words:
When introducing a boolean variable, the
b prefix is used to create a new name:
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:
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:
They detect the names not matching the rules and suggest a quick-fix (which triggers a Rename refactoring):
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:
Your ReSharper C++ Team