Visual Studio Code with UE4

Does anyone know how to get Visual Studio Codeto work with UE4?
I have not found any documentation on this.

Hi KinDaKreator,

Unfortunately Unreal Engine 4 does not currently support Visual Studio Code. The Engine looks for an installation of the full Visual Studio IDE, so you would need to be using either Express (for Windows Desktop), Community, Professional, or Enterprise.

To tell the truth, Visual Studio Code at the time Iā€™m writing this has not even got full C++ supporto (aka there is no Intellisense yet). It would be awesome to be able to work with VSCode on Mac, though. Is there any you guys at Epic will be adding something to support VSCode or any other IDE that isnā€™t Xcode?

Iā€™m answering my own question. You can use the YouCompleteMe extension to add Intellisense. You will have to add the CLionSourceCodeAccess plugin to your project and let it generate the CMakefiles for you and youā€™re set. Pretty nice!

1 Like

Cool. Thanks.

Bringing my response from another thread in here in hopes Epic Staff will see this:

"So, I think for people trying to convince their companies to use UE4 for internal projects or even as an alternative to Unity for commercial projects (where Unity has VS Code integration #handled already), this is a VERY significant ā€˜barrier to entryā€™ā€¦ you lose the ā€œbut you donā€™t need to pay unity up-front license costsā€ argument if UE4 is tethered to an IDE that costs several times (thousands) more per-seat than the Unity license in the first placeā€¦

I think this is an important feature for small (but not revenue-less) companies if they want to use Unreal. Being tethered to Visual Studio is a curse unless youā€™re a 5 man team w/ no significant revenue or a multi-million dollar corporation that can afford six-figure annual dev environment costs for your team.

Anyone from Epic have thoughts on this?"

I think the benefit to ā€œsmallā€ companies would be huge and VS Code is actually a really powerful CROSS-PLATFORM editor, so there would be several benefits to providing support I thinkā€¦

@spockTheGray third party plugins do provide support for VSCode which is free. Or you can use CLion if you already have a license for that or for the whole IntelliJ suite.

Itā€™s not straightforward to setup but once you manage to do it the first time itā€™s all there. Iā€™ll see if I can add some auto setup stuff to the CLionSourceCodeAccess plugin to provide all the VsCode and YouCompleteMe files and options needed. That should make it even easier to get it up and running

Hrm, I might have to check out these plugins you speak of - but Iā€™m not sure how this would work unless these plugins are UE4 plugins (not VS Code plugins, right?). Iā€™m guessing you can just edit w/ VS Code and then build from Unreal Editor (the pre-compiled version)?

Yes, exactly. You code with VSCode and compile with Unreal Editor. Actually you could compile from within VSCode but thereā€™s still something buggy in the CMakefiles definitions so it wonā€™t really work. But thatā€™s something that might be solved with some clever work.

The CLionSourceCodeAccess plugin is an UE4 plugin so you add it to your Unreal Editor as usual. But you want to add the YouCompleteMe extension of VSCode as well if you want autocomplete to work. And itā€™s a bit complicated to get it working as you need to go all the way to compiling and installing a VIM plugin to get everything working, but Iā€™ve already done it a couple of times on different development machines, so thatā€™s definitely doable.

Thanks for the info! Itā€™s good to know that thereā€™s at least a working alternative - Iā€™ll keep this in mind. The only downside then, I think, you canā€™t use NVIDIAā€™s Gameworks integrations (they have it integrated in the source on Github)ā€¦ but at least this could get us working w/ pre-compiled UE4.

You probably have to wait for the next release to include Gameworks but thatā€™s just part of using the pre-compiled engine vs the source code one. I guess you could actually make a few changes to the CLionSourceCodeAccess plugin to be able to use it with the source code version of UE4. That would require a bit of investigation, but Iā€™m pretty sure itā€™s doable.

Sorry but Visual Studio Community Edition is free (you just need to register with Microsoft to get tracked on their databasesā€¦) and it has most of the Professional version features.

You can select VSCode in ue 4.18 as your preferred ide

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1357546-unreal-engine-4-18-preview

Core Updates:

  • Visual Studio Code can now be used to write code on Windows, Mac, and Linux. To use it, select ā€œVisual Studio Codeā€ as your preferred IDE from the editor preferences dialog, or add the -vscode argument when generating project files on the command line.

Looks like you canā€™t compileā€¦and when i try to open a file from UE 4.18.2 in VSCode, it opens an empty fileā€¦itā€™s supposed to be the projectā€¦any ideas ?

You can currently use VSCode for UE4 projects, you can even launch the project (run debugging and run without debugging).
However, I cannot compile the project from VSCode (Terminal -> Run Build Task). The following error message appears:



The task stays running, until you delete it, the editor does not open:

Therefore I can only compile from within the editor (Hot Reload):
4.PNG

Has anyone managed to build a project from VSCode?

Well, I managed to compile/build the UE4 project from VSCode.
I have changed the configuration file, like this:



{
    "git.ignoreMissingGitWarning": true,
    "update.mode": "manual",
    "update.enableWindowsBackgroundUpdates": false,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "terminal.integrated.shell.windows0": "C:\\WINDOWS\\System32\\cmd.exe",
    "terminal.integrated.shell.windows1": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "terminal.integrated.env.windows": {
        "VsDevCmd": "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\VsDevCmd.bat\""
    },
...


1 Like

Where is this file located Helghast, also do you have Visual Studio installed on your computer for this to work ?