Building Unreal Engine From Source with Visual Studio 2022

Updated for Unreal Engine 5.1.1

This is a brief guide to downloading and building UE5 using git command line tools and Visual Studio 2022. Updated for Unreal Engine 5.1.1 and Visual Studio 2022 17.4.4

Github Account

If you don't have a github account, go to github.com and create one.

Epic Games Account

If you don't have an Epic Games account, go to epicgames.com/register and create one.

Connecting the Epic Games account to the Github account

You need to connect your Epic Games account to your github account so you can get access to Epic's github repositories.

To do this:

  • sign into your Epic Games account at epicgames.com
  • click on your username near the top right corner of the page and select "Account" from the dropdown menu
  • click on "Connections" in the list of options on the left side of the page
  • select "Accounts" from the tab bar with the "Apps" and "Accounts" options
  • under the github icon click the "Connect" button. This will guide you through a series of steps to connect your Epic Games and github accounts

Installing git

If you do not already have the git commandline tools installed, install them from git-scm.com/downloads.

Installing Visual Studio 2022

See Configuring Visual Studio 2022 for instructions on how to install and configure Visual Studio.

Downloading & Building

Downloading the source

Make a new directory such as c:\work, and change into it.

Clone the Unreal Engine source repository:

git clone https://github.com/EpicGames/UnrealEngine.git UnrealSource

where UnrealSource is the name of a new directory to which the source will be downloaded.

This takes a while, and uses 25 GB of space

Installing the UnrealVS plugin for Visual Studio

UnrealVS is a Visual Studio plugin from Epic. It is included in the UE source code. Exit Visual Studio if needed and install the file [UnrealEngineSource]\Engine\Extras\UnrealVS\VS2022\UnrealVS.vsix by double clicking it.

Choosing a branch

This page github.com/EpicGames/UnrealEngine/branches lists significant branches including:

  • release - the latest released version of UE
  • ue5-main - most up to date - this is being continuously updated and won't necessarily build or run on any given day.

Decide on a branch and change into the new source directory created by the git clone command.

Run git checkout [branch-name] for whichever branch you chose to build.

Tags

Releases are tagged by Epic. You can list the tags in a checked out release branch using this command:

git tag

If you don't have the latest tags on you system you can use this command to get them:

git fetch --tags --all

The release branch is up to date with the latest publicly released version. There are tags for major and minor versions, for example here we see the tag for release 5.4.2 show using gitk:

You can checkout a tag using this syntax:

git checkout 5.4.1-release

Building

This is a summary of information from [https://github.com/EpicGames/UnrealEngine/tree/master].

Change to the directory in which you downloaded the UE source code and run this command to download and install prerequisites required to build UE - it might take a while:

Setup.bat

then run

GenerateProjectFiles.bat -2022

Opening the Solution

The above commands will create the file UE5.sln in the current directory, open it in Visual Studio and:

  • change the Solution Configuration dropdown to "Development Editor"
  • change the Solution Platform to "Win64"
  • right click the UE5 project in the solution explorer and choose "Build".

This will take some time to complete. On a Ryzen 5950x 16 core machine using an M.2 SSD it took 37 minutes.

Running Unreal

In the solution explorer right-click "UE5" under the "Engine" entry at the top and select "Set as Startup Project".

Press F5 to run UE

Registering the Build

You can register your source build so that it appears as an option when you right-click a .uproject file. To do this use Explorer to locate and execute this file under your build directory:

.\Engine\Binaries\Win64\UnrealVersionSelector-Win64-Shipping.exe

Once you have done this you can right-click on a .uproject file and see the source build as an option like this:

Other Useful Addons

Microsoft has Unreal Engine extensions for Visual Studio which allows Visual Studio to display information about Blueprints assets in the C++ code. Instructions for installation can be found at https://github.com/microsoft/vc-ue-extensions#readme.

Earlier versions

These instructions will work for Unreal 4.27 and Visual Studio 2022. Make sure you clone the git repository then checkout the 4.27 branch before you run Setup.bat or GenerateProjectFiles.bat.

The solution file created will be called UE4.sln not UE5.sln.

References

Using an Installed Build

Feedback

Please leave any feedback about this article here