x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Visual Studio Code not working with UE

I have started using Unreal Engine and wanted to switch from VS 2017 to VSC because intellisense in VS is not very good and often simply stop working. I have set VSC to be the source code editor in UE and created a new Project called "MyProject". I also created a new C++ component called "NewActorComponent". I have installed all required plugins for VSC. However there are a lot of errors in VSC: alt text alt text alt text alt text

When trying to start the debugger I got two seperate errors, depening on which depug mode is choose: (Debug) Error pop-up: "Builderror during preLaunchTask "MyProject Win64 Debug Build" VSC terminal: ERROR: UBT ERROR: Failed to produce item [...]MyProject-Win64-Debug.exe

(DebugGame) alt text

In addition the terminal says the program exited with code 1 (see 2 pictures above).

Deleting the folders .vscode and Intermediate does not help. In short: It's impossible to work with VSC as the code editor with Unreal Engine.

Also: I have set VSC to be the DEFAULT source code editor ("Set as Default") however, this is NOT SAVED when restarting the computer!

Product Version: UE 4.18
Tags:
more ▼

asked Feb 09 '18 at 12:03 PM in Installation & Setup

avatar image

Takao_
191 6 6 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Check this link for a fix, you just need to rebuild the unreal build tool after making the relevant changes to VSCodeProjectFileGenerator.cs (Github account is required to view the link, must also be liked with your unreal account, see https://www.unrealengine.com/en-US/ue4-on-github for help with that if required)

https://github.com/EpicGames/UnrealEngine/pull/4476

Presumably the bug fix will be merged and included with the next update to the Unreal engine.

more ▼

answered Mar 13 '18 at 06:42 PM

avatar image

PaulF3D
36 5 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I have managed to eliminate some bugs:

  • When UE is generating a new project with VSC, it's not adding the "/Intermediate/Build/Win64/UE4Editor/Inc/[Project name]" path to the c_cpp_properties.json file and also is not creating the .generated.h files. Only after compiling from the editor, those files are generated. Adding the path manually to the json file and compiling the projet from the editor once does solve the include bug.

  • In each headfile you have a macro between the class keyword and the class name, called [Project name]_API (in my case MYPROJECT_API). This macro is unnown to VSC so you need to add it to the intelliSenseMode section of the json file:

    "intelliSenseMode": "msvc-x64", "defines": [ "_DEBUG", "UNICODE", "MYPROJECT_API=" ],

I still have some bugs left:

  • In my created C++ class I have the error "incomplete type is not allowed" on the inherited UActorComponent class:

    class MYPROJECT_API UNewActorComponent : public UActorComponent

I also have errors on GENERATED_BODY(): "overloaded function "UClass" is not a type name", the function BeginPlay() and TickComponent(): "member function declared with 'override' does not override a base class member". Those bugs can be resolved when I inlcude Engine.h in the headerfile, but this is not and acceptable sollution, because this is not how it should work.

  • In the cpp file for that header file I have the error "#include errors detected. Please update your includePath. IntelliSense features for this translation unit (F:\Unreal\MyProject\Source\MyProject\NewActorComponent.cpp) will be provided by the Tag Parser." for the #include "NewActorComponent.h".

more ▼

answered Feb 10 '18 at 02:12 PM

avatar image

Takao_
191 6 6 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

(I am not sure if either of these are the right answer) Have you tried uninstalling both VS2017 and VSC and then reinstalling them?
Have you looked at this Plugin? https://marketplace.visualstudio.com/items?itemName=christopherreed.ue4-cpptools

more ▼

answered Feb 20 '18 at 10:44 PM

avatar image

Colorado
21 1 2 2

avatar image Takao_ Feb 21 '18 at 01:14 AM

I have re-installed Windows recently (not because of that), so no, reinstalling both programms does not help. That plugin is no longer in the VSC marketplace and also I can't install it, because if I rename the zip file to .vsix I get an error when trying to install it.

avatar image PaulF3D Mar 13 '18 at 05:03 PM

I tried to post a reply in the Unreal Forum thread you started but its pending approval. Check this link for a fix, you just need to rebuild the unreal build tool.

https://github.com/EpicGames/UnrealEngine/pull/4476

avatar image Takao_ Mar 13 '18 at 05:04 PM

"Page not found"

avatar image PaulF3D Mar 13 '18 at 05:18 PM

Works fine for me, you need to have a GitHub account linked with your epic account to be able to see the UE4 Repo. Here is a link to guide you on getting that setup.

https://www.unrealengine.com/en-US/ue4-on-github

avatar image Takao_ Mar 13 '18 at 05:55 PM

Oh ok, I wasn't logged in -.-

I tried to open UnrealBuildTool.csproj with Visual Studio 2017, but when I build it, I get a ton of errors in the VSCodeProjectFileGenerator.cs file, mostly because this is a html document...

avatar image PaulF3D Mar 13 '18 at 06:06 PM

VSCodeProjectFileGenerator.cs is a C# source code file... You need to open/edit VSCodeProjectFileGenerator.cs in VS2017 to maintain its formatting. If you changed it with something like notepad and saved it you will lose the formatting and build errors will occur.

Posting errors or images would make it easier to help you.

Just tried it with a fresh source code build and it works perfect,

avatar image Takao_ Mar 13 '18 at 06:35 PM

For some reason I didn't download the changed file, but the webpage, no wonder the file consisted of html code only -.- Now I could compile it and VS Code works now fine, thank you :) Can you post an answere here directly, so that I can mark it as solved? (You can't do that with comments). Unreal should implement that bug fix fast, so that VS Code works with Unreal.

avatar image PaulF3D Mar 13 '18 at 06:43 PM

Glad you got it sorted, I have added an answer below to be marked as solved as requested.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question