December 12th, 2023

Directly Edit Unreal Engine Projects in Visual Studio 2022

David Li
Game Dev Product Manager

Introduction

Unreal Engine and Microsoft Visual Studio logos in white, on black

We are excited to announce that Visual Studio 2022 version 17.9 Preview 2 offers direct support for Unreal Engine projects. We would like to give a special thank you to the folks at Epic Games. Our on-going collaboration made this feature possible. In addition, this feature relies on the latest features of Unreal Engine 5.4. You will no longer need to generate a Visual Studio solution.

Currently, whenever you are working with Unreal Engine projects in Visual Studio, you must generate a Visual Studio solution from within the Unreal Editor or using the Unreal Build Tool (UBT). However, this process can become cumbersome whenever a new asset is added from within the Unreal Editor, or by another team member. In those cases, the Visual Studio solution must be regenerated to reflect these changes. With the direct support of the Unreal Engine project format (.uproject) in Visual Studio, you can now seamlessly switch between Visual Studio and the Unreal Engine editor. All your changes will be automatically synced.

First, our goal is to provide you with an experience that is on par with using the generated Visual Studio solutions without compromises. You will have access to the same rich IntelliSense and debugging capabilities that you are used to. Moreover, all the Unreal Engine-specific features that we have added to Visual Studio will work seamlessly when using Unreal Engine projects directly. For the time being, opening an Unreal Engine project directly requires the use of a source build of Unreal Engine. Additionally, we plan to extend support to older versions of Unreal Engine as well in the future. Finally, we are actively seeking feedback from all of you to improve this feature.

Getting Started with Directly Editing Unreal Engine Projects

You will need to install Visual Studio 2022 version 17.9 Preview 2 and select the “Game development with C++” workload to start previewing this feature. Make sure to also select the optional component “Unreal Engine uproject support (Preview)” as the component is required for this feature.

Visual Studio installation options

As previously mentioned, please note that this preview version requires working with a source build of Unreal Engine 5.4. To preview direct support for .uproject in Visual Studio 2022, we will use the Lyra sample game. To obtain the sample working with Unreal Engine 5.4 sources, follow these steps:

  1. Follow Epic Games’ instructions for accessing Unreal Engine source code before starting.
  2. Ensure that you are using the Unreal Engine 5.4 source code on the ue5-main branch. As the Unreal Engine code base is very large, we recommend not cloning the full history. Instead, use the following command to clone the branch:

git clone --branch ue5-main --depth 1 https://github.com/EpicGames/UnrealEngine.git

  1. After cloning, run the setup script to get the prerequisites. From the Unreal Engine source root, run:

.\Setup.bat

  1. In the source root, edit the file cpp.hint to remove the lines that define UCLASS, UPROPERTY, and UFUNCTION. Removal of these lines will enable Visual Studio’s support for those features.
  2. (Optional) We highly advice installing the Visual Studio extension for Unreal Engine to enable Blueprints integration. For a source build, follow our instructions. In short, from your Unreal Engine source root, navigate to Engine\Plugins and run:

git clone https://github.com/microsoft/vc-ue-extensions.git

  1. You are now ready to open your source code. Select “Continue Without Code” under Getting Started from the Visual Studio start screen,
    1. You do not need to build the engine before opening in Visual Studio thanks to this feature. This differs from the steps in the Unreal Engine repository.
    2. You can find the Lyra sample under the Samples\Games\Lyra directory. To preview the editing experience, open the Lyra.uproject file in the directory using the instructions provided above. To build and run this project, please see the additional steps in the next section.
  2. From the File menu in Visual Studio, select “Open”, “Unreal Engine project”, and navigate to where your project is located. Select it and open it.

Visual Studio file menu with Open, Unreal Engine project highlighted

Testing with the Lyra Unreal Engine Sample Project

Please note that the source code does not contain assets required to build and run the game. To obtain these assets, you must acquire the Lyra sample using the Epic installer.

Once you have acquired the Lyra sample, copy the Content folder from the root of the installed version of Lyra to the root of the Lyra project in the Unreal Engine sources. Additionally, there may be Content folders under some of the folders within the Plugins subdirectory. From the installed version of Lyra, copy any Content folders under Plugins folders to the corresponding parent folder of the source version of Lyra. Finally, please note that there may also be Content folders under the subfolders of GameFeatures.

After copying the assets into the source version of Lyra, you can proceed to build and debug the game in Visual Studio.

Unreal Engine Project Usage in Visual Studio

When you open an Unreal Engine Project in Visual Studio, you will notice that the Solution Explorer view closely resembles the generated Visual Studio solutions. The project shows two peer folders under a common root. One folder contains your project’s source code, while the other named “Engine” contains the sources directory from Unreal Engine.

Visual Studio Solution Explorer window in Folder View of an Unreal Engine project for the Lyra game

All your files under these folders will be readily available. You won’t need to regenerate anything to view or edit new assets added outside of Visual Studio. The toolbar dropdowns for changing your configuration and target correspond to the configurations used by the Unreal Build Tool.

The Configuration drop-down menu contains the Target Configuration and Platform.

Configuration and platform drop down option from the Visual Studio toolbar

You can find available Targets in the Target menu item.

The target drop down menu item in the Visual Studio toolbar

Apart from these features, all the other features of Visual Studio will be available and will work as you are already familiar with them. If you need information on Unreal Engine-specific features of Visual Studio, you can refer to our QuickStart guide. The configurations mentioned above are the only differences from the QuickStart guide. Integration of Unreal Engine Blueprints, Unreal Engine Log Viewer, and the Unreal Engine Test Adapter will all work the same way.

Known Issues and Roadmap

As this is a preview version, we are aware of some issues that we are currently working on addressing. If you encounter any problems while trying this out, please do share them with us via email or through this Developer Community Ticket. Here are some of the known issues:

  • Currently, your engine and game code must be on the same drive. Please send us feedback if your particular use case requires engine and game code to be on different drives.

Feedback Wanted!

The latest update enabling direct Unreal Engine .uproject support in Visual Studio 2022 is designed to further streamline and enhance your workflow while creating amazing Unreal Engine games. These and previous releases are significant steps towards our vision of Visual Studio being your home for game development. We are very grateful for your feedback, thank you. We strongly encourage you to continue sharing your thoughts and ideas with us through Developer Community, X (@VisualC), or email at [email protected].

Author

David Li
Game Dev Product Manager

I am a video game developer focused PM on the Visual C++ Team. Talk to me about video games!

0 comments

Discussion are closed.