Get started: 2 - Get and build the SpatialOS Unreal Engine fork
To use the SpatialOS GDK for Unreal, you first need to build the SpatialOS fork of Unreal Engine.
Step 1: Unreal Engine EULA
To get access to our fork, you need to link your GitHub account to a verified Epic Games account, agree to the Unreal Engine End User License Agreement (EULA) and accept the invite to join the EpicGames organisation on Github. You cannot use the GDK without doing this first. To do this, see the Unreal Engine documentation.
Step 2: Get the Unreal Engine fork source code and Unreal Linux cross-platform support
Open a terminal and run either of these commands to clone the Unreal Engine fork repository.
TIP: Clone the Unreal Engine fork into your root directory to avoid file path length errors. For example:
git clone https://github.com/improbableio/UnrealEngine.git
git clone firstname.lastname@example.org:improbableio/UnrealEngine.git
To build Unreal server-workers for SpatialOS deployments you need to build the Unreal Engine fork targeting Linux. This requires cross-compilation of your SpatialOS project and the Unreal Engine fork.
For guidance on this, see the Getting the toolchain section of Unreal’s Compiling for Linux documentation. As you follow the guidance there, select v11 clang 5.0.0-based to download the
v11_clang-5.0.0-centos7.ziparchive, then unzip this file into a suitable directory.
Step 3: Add environment variables
You need to add two environment variables: one to set the path to the Unreal Engine fork directory, and another one to set the path to the Linux cross-platform support directory.
- Go to Control Panel > System and Security > System > Advanced system settings > Advanced > Environment variables.
- Create a system variable named UNREAL_HOME.
- Set the variable value to the path to the directory you cloned the Unreal Engine fork into.
- Restart your terminal and run
echo %UNREAL_HOME%(Command Prompt) or
echo $Env:UNREAL_HOME(PowerShell). If you have registered the environment variable correctly, this returns the path to the directory you cloned the Unreal Engine fork into. If it doesn’t, check that you’ve set the environment variable correctly.
- Create a system variable named LINUX_MULTIARCH_ROOT.
- Set the variable value to the path to the directory of your unzipped Linux cross compilation toolchain.
- Restart your terminal and run
echo %LINUX_MULTIARCH_ROOT%(Command Prompt) or
echo $Env:LINUX_MULTIARCH_ROOT(PowerShell). If you have registered the environment variable correctly, this returns the path you unzipped
v11_clang-5.0.0-centos7.zipinto. If it doesn’t, check that you’ve set the environment variable correctly.
Step 4: Build Unreal Engine
Open File Explorer and navigate to the directory you cloned the Unreal Engine fork into.
Setup.bat. This installs prerequisites for building Unreal Engine 4.
This process can take a long time to complete.
While running the Setup file, you should see
Checking dependencies (excluding Mac, Android).... If it also says
excluding Linux, make sure that you set the environment variable
LINUX_MULTIARCH_ROOTcorrectly, and run the Setup file again.
In the same directory, double-click
GenerateProjectFiles.bat. This file automatically sets up the project files you require to build Unreal Engine 4.
If you encounter an
error MSB4036: The "GetReferenceNearestTargetFrameworkTask" task was not foundwhen building with Visual Studio 2017, check that you have the NuGet Package Manager installed via the Visual Studio installer.
In the same directory, open UE4.sln in Visual Studio.
In Visual Studio, on the toolbar, go to Build > Configuration Manager and set your active solution configuration to Development Editor and your active solution platform to Win64.
In the Solution Explorer window, right-click on the UE4 project and select Build (you may be prompted to install some dependencies first).
Visual Studio then builds Unreal Engine, which can take up to a couple of hours.
You have now built Unreal Engine 4 with cross-compilation for Linux.
Once you’ve built Unreal Engine, don’t move it into another directory. That will break the integration.
2019-03-27 Page updated with limited editorial review