Unreal Engine and C++ Game Development Made Easy with Visual Studio 2022
Creating amazing games just got easier. We are very happy to announce the latest Unreal Engine integrations and powerful C++ productivity features in Visual Studio 2022. Our team has been tirelessly working to incorporate your feedback and bring even more features that will enhance your game development experience whether you work on Unreal Engine or a proprietary engine.
In this blog, we will explore how you can leverage the new Unreal Engine Test Adapter, which helps to streamline your testing process without leaving the IDE. Then, we will also show you how you can code faster with Unreal Engine snippets and macro specifier suggestions, as well as view in-memory bitmaps. Next, we have included a range of core C++ productivity features and debugger enhancements that will benefit not only those working on Unreal Engine but also anyone who works on their own engines. Lastly, we will round out the blog with updates on C++ IntelliSense and debugger launch performance improvements.
Most of these productivity features are available in Visual Studio 2022 version 17.8, while some are available in the latest previews. We are confident that these features will help you be more productive and enable you to create even more amazing games.
Latest Unreal Engine Integrations
Setting Up Unreal Engine Integrations
Unreal Engine integrations will only show up when you are working on an Unreal Engine project. To ensure these features are active, double check that the “IDE support for Unreal Engine” component is enabled in the “Game development for C++” workload in the Visual Studio Installer. Some integrations such as Blueprints support and Test Adapter will require the free “Visual Studio Integration Tool” Unreal Engine Plugin. Please see Visual Studio Tools for Unreal Engine for detailed setup instructions.
Unreal Engine Test Adapter
Special thanks to the folks at Rare who contributed tremendously to this feature.
Streamline your testing process without leaving the IDE with Unreal Engine Test Adapter. You can now discover, run, manage, and debug your Unreal Engine tests. In Visual Studio 2022 version 17.8, you will automatically see your Unreal Engine Tests when you open Visual Studio. To see your tests, you can open Test Explorer with View > Test Explorer.
The latest version of our free Visual Studio Tools for Unreal Engine plugin is required to use Unreal Engine Test Adapter. In addition, ensure the “Unreal Engine Test Adapter” component in the “Game development with C++” workload is enabled in the Visual Studio Installer.
Unreal Engine Code Snippets
Write code more efficiently with Unreal Engine Code Snippets. In Visual Studio 2022 version 17.8, you can find common Unreal Engine constructs as snippets in your member list. To begin, enter the name of any Unreal Engine construct, such as “uclass”. Then, press Tab or Enter to expand the snippet.
We have also included exported versions of
UCLASS (uclass, uclassexported),
UINTERFACE (uinterface, uinterfaceexported), and
USTRUCT (ustruct, ustructexported) for those working with exported APIs and plugins. In addition, we have included macros such as
TObjectRange (tobjectrage), and
WITH_EDITOR (witheditor) based on your feedback.
List of Supported Snippets
uclass uclassexported uenum ufunction uinterface uinterfaceexported uproperty ustruct ustructexported uelog swidget tactoreange tobjectrange witheditor
Image Watch Support for Unreal Engine Projects
We are excited to announce that Image Watch for Visual Studio 2022 now supports Unreal Engine’s
FImage type. Image Watch is an extension that makes it easier than ever for you to view in-memory bitmaps while debugging C++ code. This is an essential tool for anyone working with images in C++. Be sure to try out the extension today.
Unreal Engine Macro Specifier IntelliSense
In the coming weeks, Unreal Engine developers will gradually gain access to this experimental feature in the Visual Studio 2022 version 17.8.
One of the top feedback items we commonly receive is suggesting Unreal Engine macro specifiers. We are happy to share that macro specifiers will start appearing in your member list suggestions for reflection macros in Visual Studio 2022 version 17.8. You can now quickly access all possible specifiers for respective macros without relying on memory or switching back and forth between Visual Studio and documentation.
Improved Blueprint Experience in Visual Studio
In the coming weeks, Unreal Engine developers will gradually gain access to this experimental feature in the Visual Studio 2022 version 17.9 Preview channels.
Blueprints support in Visual Studio just got easier. You can now view Blueprint references and Asset Properties without installing the Visual Studio Integration Tool plugin. The update removes the requirement for building your game before gathering Blueprint information. You will notice a significant enhancement in the way Blueprint references are handled. Visual Studio will now display CodeLens hints with less machine resources and reduced latency. Next, we have added support for including usages of UFUNCTIONs outside of the class hierarchy directly in the CodeLens results. Lastly, we will cache the results from previous scans and only process new or modified assets since the last scan.
Improved IntelliSense for Unreal Engine Projects
Unreal Engine uses its own reflection mechanism to connect its C++ and Blueprints worlds. This is achieved through custom preprocessing of C++ sources with Unreal Header Tool (UHT) and injection through the regular C++ preprocessor. In Visual Studio 2022 version 17.9 Preview 1, we have improved the handling of Unreal Engine IntelliSense by ensuring consistency and accuracy. IntelliSense in Visual Studio will now refresh more readily for UHT generated files, reducing the likelihood of displaying unwarranted errors.
Unreal Engine Macro Indentation Rules
In Visual Studio 2022 version 17.7, we’ve introduced special indentation rules for reflection macros and slate declarative syntax. We’re always looking for ways to improve, and we’ve been thrilled to hear positive feedback from the community. We would love to hear your thoughts on any additional Unreal Engine macros that you think should be considered. Please share your thoughts in the comments below or on X @VisualC.
Core C++ Productivity Features
Thanks to the amazing and positive feedback from AAA game developers, we have created many core C++ productivity features that will benefit all C++ developers.
Build Insights Functions View
Build Insights is now integrated with Visual Studio 2022 and works with MSBuild and CMake projects. Backed by MSVC’s trace capture technology, you can now see additional information relating to function generation in Visual Studio 2022 version 17.8. The new Functions View will provide you with how long a function takes during compilation as well as the number of ForceInlines associated.
Start your Build Insights .etl trace capture by going to the Build Menu.
After compilation, Build Insights will create a diagnostic report that shows you function generation time and number of ForceInlines.
New to Code Analysis in Visual Studio 2022 version 17.8, you will now see Visual Studio show suggestions to make member functions const and global functions static. You will increase your code’s consistency, readability, and security with the addition of these two features. For detailed information, please see Make Member Function const and Global Function static in Visual Studio.
Make Member Functions
Visual Studio will identify cases where a member function can be made const. This can provide additional guarantees to the caller of the function and can also enable certain optimizations by the compiler. The linter suggestion will only be offered if the member function does not mutate the state of the object.
The feature will suggest a member function can be made const by displaying three dots below the function. A message will appear when you hover over the dots, informing you that the member function can be made const. You can then click on the light bulb to make the member function const. The changes will apply to all files that have the selected member function.
This feature is on-by-default. You can customize the severity of these suggestions by going to Tools > Options > Text Editor > C/C++ > Code Style > Linter.
Make Global Functions
You will now see hints in Visual Studio when global functions can be marked as static. Static functions have linkage limited to one translation unit, which can help improve performance by allowing the compiler to perform certain optimizations. As a bonus, this will also prevent naming conflicts due to internal linkage. The feature works well with modern C++ projects and will not make suggestions for functions within anonymous namespaces. Static global functions are accessible within the translation unit where they are defined.
You will see a suggestion appear with a screwdriver icon for global functions without a forward declaration. This suggestion will indicate that you can make the function static. You can make the function static by clicking the screwdriver icon and selecting “Make this function static”.
You can also customize this feature by changing the setting in Tools > Options > Text Editor > C/C++ > IntelliSense.
Size and Alignment Information
Viewing Size and Alignment in Quick Info
In Visual Studio 2022 version 17.8, you can easily see the size and alignment of any class, struct, union, base type, or enum in C++ by simply hovering over its name. No more scrolling or searching for declarations. Just hover and get the information you need in a glance. This feature will help you write more efficient and robust code in C++.
This feature is on-by-default. To access the settings, go to Tools > Options > Text Editor > C/C++ > IntelliSense.
Thanks to your feedback, you can now use #include cleanup to remove unused headers, add direct headers, and help you maintain clean code. To maximize the use of #include cleanup, we recommend first using the direct include suggestions, then the unused include suggestions.
#include cleanup is off-by-default. You can enable it by navigating to Tools > Options > Text Editor > C/C++ > IntelliSense and selecting “Enable #include cleanup.” Once enabled, you have the flexibility to adjust the settings and configure different levels to meet your specific needs and preferences.
For detailed information on how to fully utilize the new #include clean up tool, please see Clean up C/C++ #includes in Visual Studio.
In Visual Studio 2022 version 17.8, we have made it easier for you to organize your #include directives in C++ according to your preferences.
You can sort them with a simple right-click on any #include statement and choose the “Sort #include directives” option. In addition, you can also sort them automatically with the Code Cleanup feature, which you can configure by adding “Sort #include directives (C++)” to the Included fixers section. Sorting your #include directives will help you manage your dependencies, avoid duplication, and improve your code quality.
You can configure include cleanup and sorting at Tools > Options > Text Editor > C/C++ > Code Cleanup.
#include Diagnostic References
In Visual Studio 2022 version 17.9 Preview 1, you will be able to utilize #include diagnostic references to help you analyze how your #include directives are used in your C++ code. You will see the number and locations of references for each #include directive in your codebase.
Click on the reference count to see a list of references and double-click on any reference to go to its location. This feature can greatly help you manage your dependencies and avoid duplication.
Visual Studio Performance and Debugger Improvements
Improving Time to Colorization for Large C++ Projects
In Visual Studio version 17.8, our team has implemented significant enhancements to the performance of IntelliSense and colorization in C++ files for large projects. Specifically, we’ve improved the speed at which these features become available when opening a previously accessed (cached) file. To achieve this, we’ve restructured the loading of IntelliSense state into multiple phases, with a focus on prioritizing the most critical information. This includes colorization and highlighting selected references, which are now computed first. As a result of these optimizations, you will experience a faster and more efficient experience.
Improved Debug Launch Speed for C++ Projects
In Visual Studio version 17.8, you will launch the debugger faster. We’ve substantially enhanced F5 performance for Windows applications by optimizing breakpoint setup. For example, this optimization delivers a remarkable 20% speed improvement for Unreal Editor projects. These improvements optimize file presence checks within modules, benefiting debugging C++ code with numerous breakpoints and files involved in the build process. Furthermore, we’ve streamlined the Windows PDB loading process, reducing the time required to load a PDB once it’s located.
Instrumentation Tool: New “Start with collection paused” Option
In Visual Studio 2022 version 17.9 Preview 1, the Instrumentation Tool now includes a “Start with collection paused” option for profiling C++ applications. With this feature, you can start your game under the profiler’s control without immediately collecting data. This allows you to get into the game before data collection starts. Additionally, you can resume data collection later when needed by hitting the record button.
With the latest game developer productivity updates in Visual Studio 2022, we aim to empower game developers and enhance their productivity through innovative and powerful tools. This release is another step towards our vision of a streamlined game development process. Your feedback has been instrumental in shaping our development path. We strongly encourage you to continue to share your thoughts and ideas with us by reaching out through Developer Community, surveys, X (@VisualC), or email at email@example.com. Thank you for your continued support. Together, we can drive game development to new heights with Visual Studio 2022.