This page provides detailed instructions for subscribers to download the source code for Unreal Engine (UE) from the Unreal Engine GitHub repository, and to get started working with the code.
Before you can access the repository at https://github.com/EpicGames/UnrealEngine, you must:
-
have an Epic Games account,
-
have a GitHub account, and
-
have associated your GitHub account with your Epic Games account as described on the UE on GitHub page.
You are not required to download the source code to work with Unreal Engine. If you'd rather simply download and install the binary version of Unreal, read our Installing Unreal Engine documentation to learn how to Get Unreal. However, you may find that having access to the source code can be extremely valuable for you and your project. For example:
-
You will get access to all the latest features and bug fixes that Epic engineers make every day, practically up to the minute.
-
If you find a bug that we haven't fixed yet, but that is crucial to your project, you can unblock your project by making the fix in your own version of the source code and rebuilding your own binaries.
-
You can improve the engine and help the whole Unreal community by submitting your fixes and features back to Epic.
If you are an Unreal Engine licensee, you can access the source code through our Perforce server instead of the public GitHub repository.
Accessing Unreal Engine Source Code on GitHub
Unreal Engine includes full access to the complete C++ source code, so you can study, customize, extend, and debug the entire Unreal Engine, and complete your project without obstruction.
Our source code repository on GitHub is continually updated as we develop features in our own mainline, so you don’t even have to wait for the next product release to get your hands on the very latest code.
To access Unreal Engine source code, do the following:
-
Navigate to GitHub and sign up for an account.
-
Sign in to UnrealEngine.com with your verified Epic Games account. To open your account dashboard, hover over your username, and select Personal from the drop-down menu.
-
With your account dashboard open, select the Connections tab from the sidebar. Select the Accounts tab, and then select the Connect button below the GitHub icon.
-
If you have not already signed the Unreal Engine End User License Agreement, you will need to read through its terms and select the check box, then select Link Account. If you are signed out of your GitHub account, you will be directed to GitHub to sign in after clicking the Link Account button.
-
To complete the OAuth App Authorization process, click the Authorize EpicGames button. You can learn more about this process in GitHub’s overview on Authorizing OAuth Apps.
-
GitHub will send an email inviting you to join the @EpicGames organization on GitHub. You must select the Join @EpicGames button in this email within seven days to complete the GitHub and Epic Games account linking process.
Upon completion, you will receive an email from Epic Games verifying that your GitHub and Epic Games accounts were successfully linked. If you don’t receive a confirmation email, or if your account is experiencing problems, get help from Customer Service. You are now ready to get started by going to our GitHub page (login required) to download the full source code.
Source Code Branches
You'll notice that we've published UE's source code in several branches.
Branches whose names contain dev, staging, and test are typically for internal Epic processes, and are rarely useful for end-users Other short-lived branches may appear from time to time as we stabilize new releases or hotfixes.
Release Branch
The Release branch always reflects the current official release. These are extensively tested by our QA team, so they make a great starting point for learning Unreal Engine and for making your own projects. We work hard to make releases stable and reliable, and aim to publish a new release every few months.
Main Branch
Most active development on UE happens in the ue5-main branch. This branch reflects the latest release of the engine and may be buggy or it may not compile. We make it available for developers who are eager to test new features or work in lock-step development with us.
If you choose to work in this branch, be aware that it is likely to be ahead of the branches for the current official release and the next upcoming release. Therefore, content and code that you create to work with the ue5-main branch may not be compatible with public releases until we create a new branch directly from ue5-main for a future official release.
Setting up a Perforce Server on your Local Machine
To avoid potential integration issues with our tools, such as UnrealGameSync, we recommend running a case-insensitive Perforce server.
There are two ways of running the Perforce server, P4D and P4S. P4D runs while an instance of the command line is running, so it is usually only used for spot-maintenance tasks. P4S is the service-based equivalent of P4D as it allows you to run the server in the background. The service is usually installed and started when you install the Perforce server tools.
Sometimes the service does not get run automatically. To turn the service on in Windows, first go into the Control Panel -> Administrative Tools ->Services applet. Then find the Perforce service in the list and start it:
Once the service is running, you can connect to your server using P4Admin. If this is the first connection to your server, then you can make a new user in the initial connection dialog:
Fill in the connection information for your Perforce server and press okay. Once you have connected to the server in P4Admin, you can make new depots, users, and groups pretty easily. Use P4V and the Unreal Editor to connect to the server with the credentials you supplied in the initial connection dialog.
Check out the P4Admin Documentation for more in-depth information on the ins and outs of Perforce.
P4 Typemap
Before you start adding files to your depot, you should set up your P4 Typemap so Perforce knows how to treat Unreal file types. Setting the typemap will affect how files get set to read only or writable inside of Perforce. However to do this, you will need to open a new command prompt and set up some p4 environment variables.
p4 set P4USER=your.username
p4 set P4PORT=localhost:1666
Replace the values above with your respective username and connection address. Open the typemap by entering the following in the command prompt.
p4 -P <PASSWORD> typemap
You will then see a text window open; this is your server's typemap. The typemap below is an example that we have used in the past:
# Perforce File Type Mapping Specifications.
#
# TypeMap: a list of filetype mappings; one per line.
# Each line has two elements:
#
# Filetype: The filetype to use on 'p4 add'.
#
# Path: File pattern which will use this filetype.
#
# See 'p4 help typemap' for more information.
TypeMap:
binary+w //depot/....exe
binary+w //depot/....dll
binary+w //depot/....lib
binary+w //depot/....app
binary+w //depot/....dylib
binary+w //depot/....stub
binary+w //depot/....ipa
binary //depot/....bmp
text //depot/....ini
text //depot/....config
text //depot/....cpp
text //depot/....h
text //depot/....c
text //depot/....cs
text //depot/....m
text //depot/....mm
text //depot/....py
binary+l //depot/....uasset
binary+l //depot/....umap
binary+l //depot/....upk
binary+l //depot/....udk
binary+l //depot/....ubulk
Once edited, save the file by pressing Ctrl+S on your keyboard and then exit. The command prompt should then show Typemap saved.
P4 Ignore
There might be files that you want ignored when addign client files to the depot or when reconciling client workspaces.
To help with this, you can specify a P4 Ignore file.
The default name for this file is .p4ignore
.
The following is an example of Epic's .p4ignore
file:
# Here you can specify files to ignore when adding files to the depot.
#
# The syntax for P4IGNORE files is not the same as Perforce syntax.
# Instead, it is similar to that used by other versioning systems:
#
# - Files are specified in local syntax
# - a # character at the beginning of a line denotes a comment
# - a ! character at the beginning of a line excludes the file specification
# - a * wildcard matches substrings.
#
# For example:
#
# foo.txt Ignore files called "foo.txt"
# *.exe Ignore all executables
# !bar.exe Exclude bar.exe from being ignored
#
###############################################################################
# Epic's P4IGNORE.
# P4IGNORE doesn't work like GITIGNORE:
# http://stackoverflow.com/questions/18240084/how-does-perforce-ignore-file-syntax-differ-from-gitignore-syntax
###############################################################################
# Ignore root Visual Studio solution files. We do check in some sln files in subdirectories, so only ignore
# the ones found in the root.
/*.sln
/.p4sync.txt
# Ignore all Visual Studio temp files.
*.suo
*.opensdf
*.sdf
/Engine/DerivedDataCache/*
**/DerivedDataCache/Boot.ddc
**/DerivedDataCache/**/*.udd
# Ignore all Intermediate and Saved directories
*/Intermediate/*
*/Saved/*
# Ignore UBT's configuration.xml
Engine/Programs/UnrealBuildTool/*
*.uatbuildrecord
*.tmp
# Ignore built binaries and temporary build files
*/obj/*
*.csprojAssemblyReference.cache
# Ignore UBT's log output files
/Engine/Programs/UnrealBuildTool/*.txt
# Ignore Python cached files
*.pyc
# Ignore JetBrain's IDE folders
.idea/
!.idea/runConfigurations
.gradle/
# Ignore autogenerated files from HoloLens WMRInterop
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/packages/*
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/Generated Files/*
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/x64/*
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/ARM64/*
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/x64/*
/Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/ARM64/*
# Ignore files added by Finder on Mac
.DS_Store
# Ignore all .code-workspace files
*.code-workspace
For more information about ignore files, see the P4IGNORE documentation page on Perforce's documentation site.
Server on your Local Network
You can set up a server on your local network for people to use to collaborate with one another. To do this, follow the steps above on the server and connect using the server's name or IP from your clients.
Cloud Provider
There are various cloud providers that allow you to host Perforce servers off-site and to collaborate remotely. A quick search online for Perforce Hosting should turn up a few results. Each hosting provider is different, but all should end up with a set of credentials that you can use to connect. See also Connecting from Unreal Editor below for a note about connecting to Perforce cloud providers.
Setting up a Local Workspace
To work with files that are under Perforce control, you will need to set up a Workspace so that the files can be managed on your local machine. You can do this via P4V by opening up the Workspaces tab in the View dropdown:
To create a new workspace, right-click in the Workspace window and select the New Workspace option. Then enter a name for your workspace and a location where you want the files to be on your local machine, the Workspace Root.
Once you have a server and a workspace, you will want to start adding files to it. For the moment, this needs to be done initially outside the Editor via P4V. If you already have a workspace that someone else has set up with some files already, you can skip ahead. When you create a new project, you can choose whether it incorporates C++ code and Blueprint elements. If you are using C++ code in your project, you will see a Source/ directory as well. You should initially add only the following directories of your project:
Folders and files highlighted in Green should be added to your depot. The Binaries folder in Yellow is optional, depending on how your team wants to work together. It is not required if every team member is going to compile their editor/game themselves, but should be included in the initial add if any team members will just be grabbing a version from the depot to create content. Note that the server typemap setup above should mean that coders can compile their binaries without them being set to be Read-Only by Perforce.
Adding Files to Perforce
Adding files to Perforce is something that can be accomplished in the few following steps.
-
To add files/folders to Perforce, first select the files/folders in P4V and then right-click and select the Mark For Add option.
-
This will add the files to your default change list. All files that you add can be seen in the Pending change lists tab:
-
To submit something, first right-click on the change list and then select Submit. Then enter a change list description and click the Submit button.
If you want to start work on a project that someone else has already started, you will need to get the latest revision from Perforce using P4V. To do this, find the project in the Depot View in P4V and then Right-click on the project you want to get and select Get Latest Revision. This will download all the files to the location you specified for your Workspace Root above.
Connecting from Unreal Editor
You can connect to your Perforce server right from the Editor by clicking on the Source Control icon on the Toolbar:
Once open, choose Perforce as the provider from the Source Control Login dialog and enter your login credentials. If you have a workspace already set up (that the current project is inside of), your login credentials should be populated automatically.
When using some servers, including many cloud providers - you may need to enter the Host and Password to access your depot from the Editor. You can do this by opening the advanced field at the bottom of the Perforce login dialog:
Downloading the Source Code
Please follow these instructions to download the Unreal Engine source code.
Refer to our Setting Up Visual Studio to ensure that you have a version of Visual Studio that is compatible with your desired version of Unreal Engine.
-
Install GitHub for Windows then fork and clone our repository.
To use Git from the command line, see the Setting up Git and Fork a Repo articles.
If you'd prefer not to use Git, you can get the source with the 'Download ZIP' button on the right. The built-in Windows zip utility will mark the contents of zip files downloaded from the Internet as unsafe to execute, so right-click the zip file and select 'Properties...' and 'Unblock' before decompressing it. Third-party zip utilities don't normally do this.
-
Install Visual Studio.
All desktop editions of Visual Studio can build UE, including Visual Studio Community, which is free for small teams and individual developers. Refer to the Setting Up Visual Studio page to ensure that you have downloaded all of the necessary VS components for working with UE.
-
Open your source folder in Explorer and run
Setup.bat
.This will download binary content for the engine, as well as installing prerequisites and setting up Unreal file associations. On Windows, a warning from SmartScreen may appear. Click More info, then Run anyway to continue.
A clean download of the engine binaries may take some time to complete. Subsequent checkouts only require incremental downloads and will be much quicker.
-
Run
GenerateProjectFiles.bat
to create project files for the engine. It should take less than a minute to complete. -
Load the project into Visual Studio by double-clicking on the
UE5.sln
file. Set your solution configuration to Development Editor and your solution platform to Win64, then right click on the UE target and select Build. It may take anywhere between 10 and 40 minutes to finish compiling, depending on your system specs. -
After compiling finishes, you can load the editor from Visual Studio by setting your startup project to UE5 and pressing F5 to debug.
-
Install a Git client like GitHub for Mac, then fork and clone our repository.
To use Git from the Terminal, see the Setting up Git and Fork a Repo articles. If you'd rather not use Git, use the 'Download ZIP' button on the right to get the source directly.
-
Install the latest version of Xcode.
-
Open your source folder in Finder and double-click on Setup.command to download binary content for the engine. You can close the Terminal window afterwards.
If you downloaded the source as a .zip file, you may see a warning about it being from an unidentified developer (because .zip files on GitHub aren't digitally signed). To work around it, right-click on Setup.command, select Open, then click the Open button.
-
In the same folder, double-click GenerateProjectFiles.command. It should take less than a minute to complete.
-
Load the project into Xcode by double-clicking on the UE5.xcworkspace file. Select the ShaderCompileWorker for My Mac target in the title bar, then select the 'Product > Build' menu item. When Xcode finishes building, do the same for the UE5 for My Mac target. Compiling may take anywhere between 15 and 40 minutes, depending on your system specs.
-
After compiling finishes, select the 'Product > Run' menu item to load the editor.
Our developers and support teams currently use the latest version of Ubuntu; as a result, we may not be able to provide support for other Linux distributions (including other versions of Ubuntu).
-
Install a visual Git client and fork our repository. If you'd prefer not to use Git, use the Download ZIP button on the right to get the source as a zip file.
-
Open your source folder and run Setup.sh to download binary content for the engine.
-
Both cross-compiling and native builds are supported.
Cross-compiling is handy when you are a Windows (Mac support planned too) developer who wants to package your game for Linux with minimal hassle, and it requires a cross-compiler toolchain to be installed (refer to the Linux cross-compiling page).
Native compilation is discussed in a separate README.
This page shows Licensees how to download and build Unreal Engine from our source code repository on GitHub. If you'd like to download the binary version of Unreal Engine, read our Installing Unreal Engine documentation to learn how to Get Unreal.
Additional target platforms
-
Android support will be downloaded by the setup script if you have the Android NDK installed. See the Android Quick Start guide.
-
iOS development requires a Mac. Instructions are in the iOS Quick Start guide.
-
Development for consoles and other platforms with restricted access, like Sony PlayStation, Microsoft Xbox, and Nintendo Switch, is only possible if you have a registered developer account with those third-party vendors.
Depending on the platform, additional documentation or guidance may be available in the Unreal Developer Network support site, or as a downloadable archive in the section of the Unreal Engine Forums that is dedicated to your platform.
If you don't have access to these resources, first register a developer account with the third party vendor. Then contact your Epic Games account manager if you have one, or fill out and submit the Console Development Request form for Unreal Engine if you don't. Epic will contact you with a formal agreement to digitally sign. Once this is approved, you will receive instructions on how to access source code, binaries, and additional instructions for your platform.
Licensing and Contribution
Your access to and use of Unreal Engine on GitHub is governed by the Unreal Engine End User License Agreement. If you don't agree to those terms, as amended from time to time, you are not permitted to access or use Unreal Engine.
We welcome any contributions to Unreal Engine development through pull requests on GitHub. Most of our active development is in the master branch, so we prefer to take pull requests there (particularly for new features). We try to make sure that all new code adheres to the Epic coding standards. All contributions are governed by the terms of the EULA.
Next Steps
Now that you've downloaded and set-up Unreal Engine, you're ready to build the engine from source.
Footnotes
The first time you start the editor from a fresh source build, you may experience long load times. The engine is optimizing content for your platform to the derived data cache, and it should only happen once.
Your private forks of the Unreal Engine code are associated with your GitHub account permissions. If you unsubscribe or switch GitHub user names, you'll need to re-fork and upload your changes from a local copy.