October 29th, 2024

Create Unreal Engine modules faster

Sy Brand
C++ Developer Advocate

Unreal Engine modules help keep your code organized and modular. However, creating modules can be a tedious and error-prone process that involves manually editing configuration files and adding boilerplate code.

Visual Studio 2022 version 17.11 comes with a new dialog to help with this process. With the new Add Module dialog, you can quickly add new modules to your project without leaving Visual Studio or manually editing configurations.

How to use the Add Unreal Engine Module dialog

To use the Add Unreal Engine Module dialog, you need to have an Unreal Engine project open in Visual Studio. You can do this by opening the .sln file generated by the Unreal Editor from your project folder, or by opening the Unreal Engine project directly by opening the folder containing the *.uproject file through File->Open->Folder….

Ctrl+Shift+Alt+O to open a new folder

Once you have your project open, right click on the project in Solution Explorer and select Add > Unreal Engine Item. This will open the Add New Item dialog, where you can select Empty Unreal Engine Module to launch the Add Unreal Engine Module dialog. This dialog lets you specify the name, type, loading phase, and path of your new module.

Image showing the Add Unreal Engine Module

After you click OK, Visual Studio will create the module folder and files for you and update the project settings accordingly. Visual Studio also updates the *.uproject file, registering the module there and makes sure that the module builds. You can then start writing your module code right away or use the Add Unreal Engine Class dialog to add new classes to your module.

Why use Unreal Engine modules

Unreal Engine modules are a way of organizing your code into self-contained units that can be loaded and unloaded at runtime. Modules can contain C++ code, assets, shaders, blueprints, and other resources that are related to a specific functionality or feature.

Using modules has several benefits, such as:

  • Improving code readability and maintainability by separating concerns and reducing coupling.
  • Enhancing performance and memory usage by loading only the modules needed for a given context.
  • Enabling code reuse and sharing by creating libraries of common or generic modules that can be used across different projects or platforms.

Simplifying packaging and deployment by bundling modules together into plugins or DLCs.

To learn more about Unreal Engine modules, check out the official documentation.

Give us your feedback

We hope you enjoy using the new Add Module dialog and find it useful for your Unreal Engine development. We’d love to hear your feedback and suggestions on how we can improve this feature and make Visual Studio even better for you.

Thank you for your continuous support and feedback, which helps us make Visual Studio the best tool for your development needs.

Author

Sy Brand
C++ Developer Advocate

Sy Brand is Microsoft’s C++ Developer Advocate. Their background is in compilers and debuggers for embedded accelerators, but they’re also interested in generic library design, metaprogramming, functional-style C++, undefined behaviour, and making our communities more inclusive and welcoming.