🛠

Run Unreal Engine on Linux using Visual Studio Code

2022/02/07に公開

Purpose

  • Run UE4 on Linux
  • Use VS Code as IDE, which is more familiar to me

Environment

  • Unreal Engine: 4.26.2
  • Vulkan utils: 1.1.70+dfsg1-1ubuntu0.18.04.1
  • .NET SDK: 6.0.101-1
  • OS: Ubuntu Desktop 18.04.6 LTS
  • CPU: Intel i3-8350K
  • GPU: NVIDIA GeForce GTX 1080 Ti
    • Driver: 450.156

Install

UE4

Follow Linux Quick Start to build UE4 from source code.

In short...

Download source code as zip file from GitHub.
Note that you need to connect your Epic Games account to your GitHub account.

Extract the zip file and execute the following commands:

./Setup.sh
./GenerateProjectFiles.sh
make

Vulkan utils

Execute the following commands.
(Although this is not mentioned in the above guide, without the following vulkan-utils, an error occurs when starting UE4.)

sudo apt -y install vulkan-utils
sudo apt update

VS Code

  • Download VS Code and install it.
  • Install the following extensions.
    • C/C++
    • C#
    • CodeLLDB

.NET SDK

Execute the following commands as described in Microsoft's .NET documentation.

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0

Run a C++ project with Visual Studio Code

Settings on UE4 Editor

  • In the directory where you built the Unreal Engine, execute the following commands to start the UE4 Editor.

    Engine/Binaries/Linux/UE4Editor
    
  • On UE4 Editor, select Visual Studio Code at Editor preference > Source code > Accessor > Source Code Editor.

Generate VS Code workspace

For a new C++ project

Start UE4 Editor as usual and create a new C++ project. <ProjectName>.code-workspace will be created in the project directory.

For an existing C++ project

In the directory where you built the Unreal Engine, execute the following commands. <ProjectName>.code-workspace will be created in the project directory.

./GenerateProjectFiles.sh -project="/path/to/your/project/dir/<ProjectName>.uproject" -game -engine -vscode

Execute from VS Code workspace

  • Open VS Code by right-clicking on <ProjectName>.code-workspace in the project directory.
  • Select <ProjectName>Editor (Development) (<ProjectName>) from Run and Debug, then click Start Debugging.

It will take quite a while to launch the UE4 Editor. Be patient!

Discussion