Unreal engine does not include all engine C++ directories when I add code from the editor

Hello all, I want to let you all know that I’ve discovered a reason for receiving this error even though that class never existed in my project in the first place:

The problem turns out to be that Unreal Engine does not add all the required Unreal Engine Source directories. When I inspect my Source Directories, the last include directory abruptly ends like so:

There is no directory named …\Engine\Private\User, BUT there is a directory named …\Engine\Private\UserInterface. I then compared all of my include directories with the include directories of the sample C++ 2D project and indeed Unreal Engine did not add in appx. 40 or so directories.

This was quite the headache because all the errors I received from the Log weren’t very helpful either.

So I tried to add in those missing directories via copy & paste from the sample C++ 2D project and Windows wouldn’t let me. I’m guessing that the maximum length was reached in the above source directories dialog box. I can add directories in 1 by 1 by clicking the folder icon located in the Source Directories dialog box but that is incredibly tedious.

Does anybody know what text file I must edit so that Visual Studio is aware of all the missing directories? I tried looking at all the generated Visual Studio files but I couldn’t find where those include directories are stored.

Thanks.

Well, well. Guess who didn’t read the docs. I just had to add modify my *.uproject file to have the plugins I needed. I also needed to modify the *.Build.cs file to include those plugins. I just needed the Paper2D plugin. After rebuilding, everything was fine.

*.uproject:

{
	"FileVersion": 3,
	"EngineAssociation": "4.7",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "MyPaper2DGame",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	],
	"Plugins": [
		{
			"Name": "Paper2D",
			"Enabled": true
		}
	]
}

and *.Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D" });

This setting - “Source Directories” is just used for VS “IntelliSence”.
These directories will be changed when a project has immigrated from a computer to another. And the VS “IntelliSence” function will be invalid.
How can we do?
We can open maunally the project setting file “xxxx.vcxproj” in the path “Project-DIR/Intermediate/ProjectFiles” with the third-part tools (such as UltraEdit). The file is a XML-format document. We can replace these invalid Path text in a editor and save it.
However, I suggest we shall use Environment-Variable in the similar path setting instead of abstract path to void this matter.