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:
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 )
Hello, i had a problem downloading Unreal engine 4
When running it it immediately crashes with error 0xc000007b “Application stopped working”. That’s allit gives me. Any ideas on how to fix it?
Thanks
Hi, were you able to step through engine code with your setup?
For me, every time vscode tries to open an engine file I’ll get something like “Unable to open ”: File not found (file:///d:/build/++ue4/sync/engine/).”
Hmm I cannot say I have this problem. Are you opening visual studio code from the Unreal Editor ? Have you tried checking out if you have plugins that are conflicting maybe ? Do you perhaps need to install the various plugins ( c++ / unreal snippets ) ? Perhaps try regenerating the project files. Perhaps if you have any errors we can see what else can be done.
If it helps I am running Unreal 4.20 and 4.21 both seem to work. While Visual Studio Code is version 1.28.2. Here is a quick screenshot of the Engine.h file for example. https://i.imgur.com/YtfsJ1O.png
Thanks for this post!
Wanted to get back into Unreal and things have changed slightly since a few years ago so certainly saved me a lot of time to switch from Visual Studio to VSCode which is my current editor of choice for Golang/Python etc
It’s good to good to see it so well integrated though I doubt I’d ever have imagined it could be possible like this without your help!
Hi, Thanks for this post!
I can setup project with visual studio code after reading this article. and Build is successful.
But whenever I hit F5 key to debug, code always shows me this error, “ERROR: Missing precompiled manifest for ‘Launch’. This module was most likely not flagged for being included in a precompiled build – set ‘PrecompileForTargets = PrecompileTargetsType.Any;’ in Launch.build.cs to override.”.
Can you give me an idea to solve this problem?
Did u mean go on icon of debug in vscode, in the combo on right of “Run” button select “[ProjectName]Editor (DebugGame) ([ProjectName])” ? It’s work for me.
Whenever I try to open vscode from the editor I get an error message: “Solution not found.”
I’ve rechecked the process and I didn’t miss anything, any debugging advice?
Sorry for posting on a fairly old article but I am running into some issues trying to set up Visual Studio Code on my unreal and was wondering if you have any insights.
Windows 10 OS
I configured it inside the editor and restarted after it needed to rebuild. I launched with open code but got the message it was “unable too open”.
Interestingly enough I tried using Visual Studio by itself and it works fine for opening just does not seem to like Visual Studio Code! (I am on version 4.24.3 of unreal engine) any ideas? It looks like it generated the code-workspace file after I ran it, but just won’t open for some strange reason…
Also, forgive my ignorance as I am fairly new to unreal. But what are the advantages to using Visual Studio Code over Visual Studio in unreal?
Hmmm once you generate the project files for Visual Studio Code from within the Unreal Editor you should be able to “launch” VSC from within Unreal. If for some reason that process is not generating the required project files you may want to delete them and try again. While I have not seen this type of corruption to project files you never know. It’s fairly safe to re-do the process.
The fact that you mention Visual Studio itself works that’s positive. Once you generate your project files you should see similar build and run options between Visual Studio and Visual Studio Code https://imgur.com/a/wrok9ut
Regarding why use Visual Studio Code vs Visual Studio ? It’s a preference really. Some people like a quick IDE without a lot of flashy tools while others prefer the vanilla installation. At this point if you are just new to Unreal I would suggest stick to Visual Studio + Resharper C++ Plugin if you have a few bucks to throw at it as it will save you a fair bit of work when it comes to intellisense. Other than that I would say just work on learning the techniques and the language and as you develop your skills you will decide which IDE is best for you. Unreal runs on a few different platforms so you can experiment ( Xcode, Rider, CLion, etc )
Thanks for the response! Good to know it isn’t too big of a difference. I kind of figured it would be just a faster load than VS itself. I’ll focus primarily on the niche of UE with C++ and worry about the rest later as you’ve suggested.
Hey! Really enjoying being able to work with VSCode using UE4. Really makes my development environment much cleaner.
My only question is, do you know how to generate project files for VSCode from outside the Editor? My team and I spend a lot of time rebuilding the engine and generating project files, but it’s always the default (Windows: VS / Mac: XCode). I can’t find any info on updating the GenerateProjectFiles script to generate a specific solution type.
You could take a look and see if there is enough overrides to manage this. Alternatively you could catch the commands through the “generate project files” / “refresh project” operations in the editor and see where they go. The output engine logs should provide some of that insight.
If you do happen to come across a solution would be curious to know ! Thanks
Hi Wojtek. In your list of extensions for VS Code, you include both the MS C/C++ extension as well as the third party “C++ Intellisense” extension. Both of these extensions attempt to register to provide the same language service features. To avoid issues, I’d recommend using either the C/C++ Extension OR the C++ Extension, not both. Also, the C/C++ extension includes Clang-format support. 🙂
Hello, i had a problem downloading Unreal engine 4
When running it it immediately crashes with error 0xc000007b “Application stopped working”. That’s allit gives me. Any ideas on how to fix it?
Thanks
I personally have not seen this error, but looking over the unreal community there is some discussion here https://answers.unrealengine.com/questions/794080/0xc000007b-i-cant-fix-it.html as well as https://answers.unrealengine.com/questions/738484/unreallightmassexe-error-0xc000007b-unable-to-star-1.html perhaps reinstalling the DLL files and / or re-generating the visual studio project will help. Perhaps if you have details on your output / stacktrace log that will help as well.
Hi, were you able to step through engine code with your setup?
For me, every time vscode tries to open an engine file I’ll get something like “Unable to open ”: File not found (file:///d:/build/++ue4/sync/engine/).”
Hmm I cannot say I have this problem. Are you opening visual studio code from the Unreal Editor ? Have you tried checking out if you have plugins that are conflicting maybe ? Do you perhaps need to install the various plugins ( c++ / unreal snippets ) ? Perhaps try regenerating the project files. Perhaps if you have any errors we can see what else can be done.
If it helps I am running Unreal 4.20 and 4.21 both seem to work. While Visual Studio Code is version 1.28.2. Here is a quick screenshot of the Engine.h file for example. https://i.imgur.com/YtfsJ1O.png
Thanks for this post!
Wanted to get back into Unreal and things have changed slightly since a few years ago so certainly saved me a lot of time to switch from Visual Studio to VSCode which is my current editor of choice for Golang/Python etc
It’s good to good to see it so well integrated though I doubt I’d ever have imagined it could be possible like this without your help!
Cheers from London
Hi, Thanks for this post!
I can setup project with visual studio code after reading this article. and Build is successful.
But whenever I hit F5 key to debug, code always shows me this error, “ERROR: Missing precompiled manifest for ‘Launch’. This module was most likely not flagged for being included in a precompiled build – set ‘PrecompileForTargets = PrecompileTargetsType.Any;’ in Launch.build.cs to override.”.
Can you give me an idea to solve this problem?
Make sure you’re building win64 debuggame. Just debug or html5 will bring up that error.
Also select the proper debug profile in the VSCode debugging options
Did u mean go on icon of debug in vscode, in the combo on right of “Run” button select “[ProjectName]Editor (DebugGame) ([ProjectName])” ? It’s work for me.
Whenever I try to open vscode from the editor I get an error message: “Solution not found.”
I’ve rechecked the process and I didn’t miss anything, any debugging advice?
sadly my GPU only support up to 4.17 otherwise it will encounter DX11 feature level 11 required..and at 4.17 no vscode option inside the drop down.
You could add how to add modules:
just add them in the modules field of *.uproject file.
HI friend,
Sorry for posting on a fairly old article but I am running into some issues trying to set up Visual Studio Code on my unreal and was wondering if you have any insights.
Windows 10 OS
I configured it inside the editor and restarted after it needed to rebuild. I launched with open code but got the message it was “unable too open”.
Interestingly enough I tried using Visual Studio by itself and it works fine for opening just does not seem to like Visual Studio Code! (I am on version 4.24.3 of unreal engine) any ideas? It looks like it generated the code-workspace file after I ran it, but just won’t open for some strange reason…
Also, forgive my ignorance as I am fairly new to unreal. But what are the advantages to using Visual Studio Code over Visual Studio in unreal?
Hmmm once you generate the project files for Visual Studio Code from within the Unreal Editor you should be able to “launch” VSC from within Unreal. If for some reason that process is not generating the required project files you may want to delete them and try again. While I have not seen this type of corruption to project files you never know. It’s fairly safe to re-do the process.
The fact that you mention Visual Studio itself works that’s positive. Once you generate your project files you should see similar build and run options between Visual Studio and Visual Studio Code https://imgur.com/a/wrok9ut
Regarding why use Visual Studio Code vs Visual Studio ? It’s a preference really. Some people like a quick IDE without a lot of flashy tools while others prefer the vanilla installation. At this point if you are just new to Unreal I would suggest stick to Visual Studio + Resharper C++ Plugin if you have a few bucks to throw at it as it will save you a fair bit of work when it comes to intellisense. Other than that I would say just work on learning the techniques and the language and as you develop your skills you will decide which IDE is best for you. Unreal runs on a few different platforms so you can experiment ( Xcode, Rider, CLion, etc )
Thanks for the response! Good to know it isn’t too big of a difference. I kind of figured it would be just a faster load than VS itself. I’ll focus primarily on the niche of UE with C++ and worry about the rest later as you’ve suggested.
Hey! Really enjoying being able to work with VSCode using UE4. Really makes my development environment much cleaner.
My only question is, do you know how to generate project files for VSCode from outside the Editor? My team and I spend a lot of time rebuilding the engine and generating project files, but it’s always the default (Windows: VS / Mac: XCode). I can’t find any info on updating the GenerateProjectFiles script to generate a specific solution type.
Any help appreciated, thanks!
Jack
Hi Jack,
Unfortunately I have not messed around with the project generation batch files too much but it looks like they are available as part of the Engine source code. Specifically the following https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Build/BatchFiles/GenerateProjectFiles.bat
You could take a look and see if there is enough overrides to manage this. Alternatively you could catch the commands through the “generate project files” / “refresh project” operations in the editor and see where they go. The output engine logs should provide some of that insight.
If you do happen to come across a solution would be curious to know ! Thanks
Hi Wojtek. In your list of extensions for VS Code, you include both the MS C/C++ extension as well as the third party “C++ Intellisense” extension. Both of these extensions attempt to register to provide the same language service features. To avoid issues, I’d recommend using either the C/C++ Extension OR the C++ Extension, not both. Also, the C/C++ extension includes Clang-format support. 🙂