Setting Up Visual Studio for UE4

Unreal Engine 4 (UE4) is designed to integrate smoothly with Visual Studio, allowing you to quickly and easily make code changes in your projects to immediately see results upon compilation. Setting up Visual Studio to work with UE4 can help improve efficiency and the overall user experience for developers using UE4.

In this document, we'll cover the basics for setting up your UE4-to-VS2013 workflow.

Before Setting-up your UE4-to-VS Workflow

It's important to note that Visual Studio 2015 (VS2015) doesn't install C++ tooling support by default. When installing VS2015, choose Custom installation and then choose the C++ components that you'll need for your workflow. If you've already installed Visual Studio 2015, choose File > New > Project > C++ to install C++.

The following table lists which versions of Visual Studio are integrated with the binary version of UE4.

Unreal Engine Version Visual Studio Version
4.10 or Later VS2015
4.2 to 4.9 VS2013

Open source versions of UE4 (available via GitHub and P4) are integrated with VS2013. Also, earlier versions of UE4 integrated with older versions of Visual Studio aren't covered in this document.

Recommended Settings

The following are recommended settings for developers using Visual Studio with Unreal Engine 4.

  1. Increase the width of the Solution Configurations dropdown menu by performing the following steps:

    1. Right-click on the toolbar and select Customize at the bottom of the menu that appears.

      SelectingCustomize.png

    2. Click on the Commands tab.

      ClickCommandsTab.png

    3. Select the Toolbar radio button.

      SelectToolbarRadioButton.png

    4. In the dropdown next to Toolbar, choose Standard.

      SelectStandard.png

    5. In the Controls list at the bottom, select the Solution Configurations control.

      SelectSolutionConfigControl.png

    6. Click Modify Selection on the right.

      ClickModifySelection.png

    7. Set the Width to '200'.

      SetWidth_200.png

    8. Click Close. Your toolbar should update immediately.

      ClickClosetoUpdateToolbar.png

  2. Add the Solution Platforms dropdown by performing the following steps.

    1. Find the right-most button on the Standard toolbar, which opens a dropdown menu that will allow you to add and remove buttons from the toolbar.

      SelectDropDownButton.png

    2. Click the dropdown button, hover over Add or Remove Buttons, and then click on Solution Platforms to add the menu to the toolbar.

      SelectSolutionPlatforms.png

  3. We recommend that you turn off the Error List window. Typically, the Error List window pops up automatically when you have an error in your code. However, when working with Unreal Engine, the Error List window can display false error information. It's best to disable the Error List window and use the Output window to see real code errors when working with Unreal Engine. The following steps show you how to turn off the Error List window:

    1. Close the Error List window if it is open.

    2. From the Tools menu, open the Options dialog.

      OpenOptionsDialog.png

    3. Select Projects and Solutions and uncheck Always show Error List if build finishes with error.

      UncheckErrorsListOption.png

    4. Click OK.

Other configuration steps you may find useful are:

  • Turn off Show Inactive Blocks. If you do not, many chunks of code may appear grayed out in the text editor. (Tools > Options > Text Editor > C/C++ > View).

  • Set Disable External Dependencies Folders to True to hide unneeded folders in the Solution Explorer. (Disable External Dependencies Folder in Tools > Options > Text Editor > C/C++ > Advanced)

  • Turn off Edit & Continue features, you do not need them. (Tools > Options > Debugging > Edit and Continue)

  • Turn on IntelliSense. (See Intellisense, Live Errors, and Squiggles )

Recommendation for Visual Assist X Users

If you have Visual Assist X installed:

  • Turn off Format After Paste (VAssistX > Visual Assist X Options > Advanced > Corrections). If you don't disable this option, Visual Assist X automatically formats your source code, potentially resulting in poorly formatted documents.

Intellisense, Live Errors, and Squiggles

UE4 projects now have proper IntelliSense support, including a live Error List and squiggles. (See below for how to enable it.)

IntelliSense recompiles C++ as you type. This is a lot more powerful than only VAX's syntax checking, as it uses a full C++ compiler that verifies every line of code. It is awesome and it will speed up your workflow!

VC++ Intellisense Squiggles

Along with squiggles, you will also see IntelliSense errors in the Error List for any file you are looking at. You can turn this on or off in the right-click menu in the Error List.

Error List

You may have already disabled Squiggles because they did not work with UE4 projects. Make sure to hit the C/C++ Advanced tab and use settings similar to below.

VC++ Advanced Options

When you open a C++ file, you can see the IntelliSense compiler "working" by looking for this icon:

Intellisense Progress Indicator

Implementation Details

  • It sometimes takes a few seconds for squiggles to appear when you edit code.

    • This is just because we have tons of include files, and IntelliSense does not use PCHs currently.

  • Sometimes you will see "false positive" IntelliSense errors. There are a few possible reasons.

    • The IntelliSense compiler (EDG) is more strict than the MSVC compiler.

    • Some #defines are setup differently for IntelliSense than when building normally.

    • C++ compiled by IntelliSense is always treated as 32-bit.

  • You can wrap code in #ifdef __INTELLISENSE__ to eliminate squiggles if absolutely necessary.

  • The IntelliSense errors are phrased a bit differently than the VC++ compiler's errors. That is just how it is.

  • Squiggles in header files work by compiling the header against a known .cpp that includes it.

    • Sometimes IntelliSense screws this up and you will see squiggles in headers.

  • There is a Max Cached Translation Units setting (shown above) that you can increase if you want.

    • It uses more memory, but might increase responsiveness a bit.

  • A few C++ files still are not compatible with IntelliSense yet.

  • Unreal Build Tool has a new -IntelliSense option.

    • This will spit out IntelliSense property sheets for all of our project files.

    • This only needs to be re-run when new modules are added, or project includes are changed.

UnrealVS Extension

The UnrealVS extension for Visual Studio provides easy access to common actions when developing with Unreal Engine 4.

unrealvs_toolbar_cmd.png

Features include:

  • Setting the Startup Project.

  • Bindable command for building the Startup Project.

  • Setting the command line arguments.

  • Batch building projects.

  • Quick Build project menu.

The UnrealVS extension does not work with the Visual Studio Express editions. It is only compatible with Visual Studio Community and Professional editions.

See the UnrealVS Extension page for information on setting up and using the extension.

Debugging

Visual Studio has support for extending the debugger with visualizers that allow easy inspection of common Unreal types such as FNames and dynamic arrays.

Installing the UE4 Visualizer for Visual Studio 2013

Installing the UE4 Visualizer is a two-step process.

  1. Locate the file containing the visualizer logic as part of your installation:

    • [UE4Root]/Engine/Extras/VisualStudioDebugging/UE4.natvis

  2. Copy UE4.natvis to either of the following locations:

    • [VisualStudioInstallPath]/Common7/Packages/Debugger/Visualizers/UE4.natvis

    • [UserProfile]/My Documents/Visual Studio 2013/Visualizers/UE4.natvis

Copying the file to your Visual Studio install directory may require administrator permissions.