Unreal C++ with Visual Studio Code

By November 2, 2018Development, Tutorial

In the spirit of show casing alternative ways of working with Unreal and C++ I wanted to share with you guys how to use Visual Studio Code as your primary IDE.

Visual Studio Code is a fairly lean IDE based on the Electron framework that was designed to tap into the market of Sublime, Atom, etc etc but it works just fine as a C++ editor.

Similar to my earlier post there are a few prerequisites you need to have available / installed to follow this tutorial:

  • Ensure that you either have Visual Studio Community 2017  installed or alternatively just the Visual Studio Build Tools as you need something to still compile the code.
    • Visual Studio Code will recognize what you have these packages installed and assign the correct compiler configurations
  • Unreal Engine 4.20.3
  • Visual Studio Code
  • Windows 10

Once you have these pieces installed, let’s move onto the Unreal Editor configuration

  • Open Unreal Editor ( source or binary doesn’t matter )
  • Go to Edit -> Editor Preferences

  • Then go to General -> Source Code -> Source Code Editor and select Visual Studio Code

  • Once this is done you should now be able to generate a new Visual Studio Code project  using File -> Generate Visual Studio Code Project

  • This generation step will take a few seconds to complete
  • To open up Visual Studio Code go to File -> Open Visual Studio Code

You should now be able to see the IDE getting launched from Unreal and your project available for compilation.

The only other thing you need to be aware of is how to get at the build targets.

To do so you can go to Terminal -> Run Build Task or simply hit CTRL + SHIFT + B

That’s it !

You are now setup to use Visual Studio Code.

 

 

Additional Information

The only other thing you may want to setup within Visual Studio Code are a number of plugins that assist with intellisense, auto complete, etc etc

Here is a list of plugins I currently have configured:

Deleting Visual Studio Code references and changing back to a different editor

In case you are not happy with Visual Studio Code and want to revert things back to use Visual Studio I recommend cleaning up the files the VS Code integration generated.

Specifically the following folders / files inside of your root project:


.vscode/
[PROJECTNAME].code-workspace

Once this is complete you simply follow the initial set of instructions but instead of picking VS Code just select Visual Studio 2015/2017. This should then give you the option to re-generate the Visual Studio project within Unreal Editor ( File -> Refresh / Generate Visual Studio Project )

2 Comments

Leave a Reply