In this post we explore how to build UE from source. You may want to do this for several reasons, but the main one is often to make a build with Server Target.
I am doing this to build for PlayFab GSDK: gsdk/UnrealPlugin at main · PlayFab/gsdk · GitHub
Some useful links:
- Accessing UE in GitHub: Unreal Engine on GitHub
- Downloading source code: Downloading Unreal Engine Source Code | Epic Developer Community (epicgames.com)
- Building the engine: Building Unreal Engine from Source | Epic Developer Community (epicgames.com)
- Unreal Engine 5.3.2 release tag: Release Unreal Engine 5.3.2 · EpicGames/UnrealEngine (github.com)
- Download Visual Studio 2022: Download Visual Studio Tools – Install Free for Windows, Mac, Linux (microsoft.com)
- Download 7-Zip: Download (7-zip.org)
You will need to have GitHub configured and subscribed to EpicGames in order to access the repository – it’s free to do so and won’t take too long.
Downloading the source
There are multiple ways of downloading UE source from github:
- clone via github
- download as ZIP
- download release as a ZIP (my personal choice)
Clone from Git CLI
The first option is to clone from Git Command Line Interface (CLI).
This is perhaps the most common way of doing it, it’s quite simple but you will need Git installed and configured on your machine to do it – it’s quite simple and useful so I would recommend to do that anyway.
In order to clone it with git commands, if you configured SSH, is to type:
git clone git@github.com:EpicGames/UnrealEngine.git
which is git clone <url>
.
If like me, your internet is not great, you may want to do a shallow clone. Simply add --depth=1
to the command, like this:
git clone --depth=1 git@github.com:EpicGames/UnrealEngine.git
You can find additional documentation on this here: Get up to speed with partial clone and shallow clone – The GitHub Blog
This basically doesn’t clone the entire repository (history).
Download project ZIP
This is pretty simple, just click ‘Download ZIP’ as highlighted above. This is alternative to doing the git clone.
Download release
This is perhaps the simplest way of doing this and if you don’t plan to make any (or very few) changes in UE, I would suggest this as preferred method, but its entirely up to you.
Simply click on the release you’re interested in, most recent at time of writing is 5.3.2.
And just click to download the ‘Source code (zip)’.
This will download only the release files, it will not come with git configurations – so if you will want to download a different release, you will need to download it separately.
Once downloaded, simply extract the files and you now have the source.
Note: you may need to use an extraction tool like 7-Zip (Download (7-zip.org)) in order to extract the folder as its quite large.
Pre-requisites for source code
Now that you have the source code downloaded, you will need to prepare it before you can compile it.
Thankfully, its now very simple to do so!
Open up your source folder and execute Setup
– if running on Windows machine, execute the Windows Batch File.
Depending on your machine and network speed, this can take a while. My network speed is not that fast and it can take up to 2 hours to run for me.
Once the Setup has run, you’re ready to execute the GenerateProjectFiles
batch file.
This will create the Visual Studio Project files.
Preparing Visual Studio
If you have Visual Studio installed and configured, you can skip this section.
You will need to download the Visual Studio Installer tool to do this.
Download Visual Studio Tools – Install Free for Windows, Mac, Linux (microsoft.com)
Using the installer, you will be able to install or configure your Visual Studio Community (2022)
When configuring the Visual Studio, these are the packages I selected:
- .NET desktop development
- Desktop development with C++
- Game development with C++
I also modified the Windows 10 SDK to a lower version – you may not need to do this, but it was recommended in one of documents I saw a while back
You don’t need to do this, but if you wish to do the same, you can go into ‘Individual components’ tab and select it there
Compiling the project
Once you’ve run the Setup and GenerateProjectFiles you will have generated UE5.sln.
Also while you’re here, try and minimize the path to to this folder as it can cause issues if its too long (see in video).
Now select Development Editor and Win 64 and right click UE5 and click build.
This can take a while to build, for me it was about 50 minutes and I am running with Ryzen 9 CPU.
Using the engine
Now to start up the engine, you can right click UE5 and under Debug select Start New Instance.
When starting it for the first time, it can take several minutes while it compiles shaders.
In order to switch your existing projects to this source build, find your project file and right click then select Switch Unreal Engine Version.
Then simply select the new source build from the list.