Unreal Engine Integrations for Visual Studio Code
Unreal Engine Integrations for Visual Studio Code connects Unreal Engine tooling with VS Code and
the larger extensions ecosystem. This extension is targeted at developers working with C++ or .NET
source code as part of an Unreal project.
Only works with Unreal Engine 5.6 and later.
Unreal Engine for Fortnite is not supported.
Note:
Linux and macOS are not currently tested as host platforms. However, some features are expected
to work in those environments.
Features
- Easy C/C++ IntelliSense with C/C++ extension.
Support for
clangd
is experimental.
- Run
UnrealBuildTool as Tasks.
- Schema support for known JSON-based Unreal Engine files.
- Syntax highlighting for configuration files.
Quickstart
For a project with its own Engine sources, open the the root directory
as a workspace folder. Otherwise, open the folder containing the .uproject file.
Note:
It is not necessary to generate a VS Code workspace using Unreal Editor, and using a generated
workspace will likely interfere with this extension.
Configure C/C++ IntelliSense by opening the C/C++ extension settings file
(C/C++: Edit Configurations (JSON) from Command Palette) and addding the following configuration
entry. Make sure it is the active configuration if multiple entries are defined.
{
"configurations": [
{
"name": "UnrealBuildTool",
"configurationProvider": "skyboxlabs.unrealengine-tools"
}
]
}
Use the command Unreal (C++): Select Build Configuration... to select the desired project and
confguration.
C++ IntelliSense should now activate. Use the contributed tasks under UnrealBuildTool to begin
compiling your project, or define your own using the UnrealBuildTool task type; see
Customizing Build Tasks.
For C# IntelliSense, generate a minimal Visual Studio solution using the command
Unreal (C#): Generate Projects, then open the generated solution with C# Dev Kit
using .NET: Open Solution.
Note:
While this extension is multi-root workspaces
aware, only the first workspace is used for Unreal Engine integrations. It is not possible to
work with multiple projects at the same time.
Customizing Build Tasks
Use Tasks to invoke UnrealBuildTool. Some
tasks are provided out-of-the-box. See examples below for other useful recipes:
// .vscode/tasks.json
{
"tasks": [
{
// Build LyraEditor for Windows.
"label": "Unreal (C++): Build LyraEditor Win64 Development",
"type": "UnrealBuildTool",
"args": {
"mode": "Build",
"target": "LyraEditor",
"platform": "Win64",
"configuration": "Development",
},
"group": "build",
},
{
// Build the current active configuration. Most configuration values
// can be omitted. The extension will auto-populate values based on the
// active project and build configuration.
"label": "Unreal (C++): Build active configuration",
"type": "UnrealBuildTool",
"args": {
"mode": "Build",
},
"group": "build",
},
{
// Build only the module containing the currently opened source file for fast
// iteration. Module specification has special handling for '${file}'.
"label": "Unreal (C++): Build current module",
"type": "UnrealBuildTool",
"args": {
"mode": "Build",
"modules": [
"${file}"
]
},
"group": "build",
},
{
// Execute UBT with arbitrary arguments
"label": "Run UBT -Help",
"type": "UnrealBuildTool",
"args": ["-Help"],
},
],
"version": "2.0.0"
}
C++ Debugging
Command variables
are provided to make it easy to launch or attach the appropriate
C/C++ debugger:
{
"configurations": [
{
"name": "Launch active target with project file",
"type": "cppvsdbg",
"request": "launch",
"program": "${command:unrealengine.vars.cpp.targetExecutable}",
"args": [
"${command:unrealengine.vars.cpp.projectFile}",
],
"cwd": "${workspaceFolder}",
},
{
"name": "Attach active target",
"type": "cppvsdbg",
"request": "attach",
"program": "${command:unrealengine.vars.cpp.targetExecutable}",
}
],
"version": "2.0.0"
}
These command variables are currently available:
unrealengine.vars.projectName, unrealengine.vars.projectFile, unrealengine.vars.projectFolder:
Name, file path, and folder path of the currently opened project.
unrealengine.vars.cpp.target, unrealengine.vars.cpp.platform, unrealengine.vars.cpp.configuration:
Target name, platform, and configuration type of the active configuration.
unrealengine.vars.cpp.targetExecutable: Path to the executable built by the active configuration.
unrealengine.vars.cpp.projectFile, unrealengine.vars.cpp.projectFolder: Name, file path,
and folder path of the project for the active configuration. This can differ from the
open project if the active target does not use modules from the project.
When using Microsoft's C/C++ extension (cppvsdbg or cppdbg), the .natvis file provided with
Unreal Engine is activated automatically.
Extension Configuration
In general, this extension attempts to keep its configuration surface as small as possible, and do
not expose settings that are configurable elsewhere. However, a limited number of configuration
options are available to facilitate integration.
unrealEngine.tools.environmentVariables: Additional environment variables to use when invoking
Unreal Engine's tools. Use this to, for example, configure Linux cross-compiler:
// .vscode/settings.json
{
"unrealEngine.tools.environmentVariables": {
"LINUX_MULTIARCH_ROOT": "C:\\UnrealToolchains\\v26_clang-20.1.8-rockylinux8",
},
}
unrealEngine.cpp.lsp: Explicitly choose which C/C++ extension to integrate with, if any.
The following configurable settings are availble only for the workspace folder's settings.json:
unrealEngine.enginePath: Path to the Engine installation the projects in this workspace.
This is used only when the workspace does not contain a valid Engine/ folder at its root.
Some commands will update this value automatically.
unrealEngine.defaultProject: Relative path to the .uproject file to open for this workspace,
if it's not at the root of the workspace folder. This value is updated by the extension when
switching to a new project.
Experimental Features
clangd Integration
Note:
clangd has interoperability challenges that reduces its accuracy when used with some of the
"clang-derived" or "clang-compatible" compilers supported by Unreal Engine. This extension
does not aim to provide support for clangd that is on-par with Microsoft's C/C++ Extension.
The Unreal (C++): Generate clangd configuration files command writes .clangd files that the
clangd extension
can use to provide clangd language server features. Configuration files are written at the top
level of each known Unreal module that is part of the workspace. They need to be explicitly
regenerated after changing the active build configuration, enabled plugins, or module definitions.