[UE 5.1] VisualStudio 2022 Intellisense for engine files not working in UE5

When programming in UE4 when I open engine source files from within a project (e.g Actor.h) all the intellisense works as expected.

However, when I make C++ projects within UE5 and open the same engine files (e.g Actor.h) all the #include lines and others show no intellisense working.
See image below
image

The intellisense error is “Canot find file X” where X is the import in question.

Both UE4 and UE5 installed from the Epic Games Launcher (with Engine source and editor debugging symbols). I’m using Visual Studio 2022.

Has anyone else experienced something similar? Does anyone know how to solve this?
If this works for someone else I’d love to know what you did.

6 Likes

Hi @adiswa123,
These screenshots show how to set up Visual Studio 2022
Open the IntelliCode window


Scroll to the bottom to accept terms to use UE5

Now got to Tools → Options IntelliCode → Advanced

Enable all the Enabled in bold

Click ok and the IntelliCode runs in the background setting up the database.
This can take 15 minutes depending on the performance of your PC

3 Likes

Hey @Jimbohalo10 ,

Thanks for the answer. I tried what you suggested, enabled all those settings and it didn’t work. I also uninstalled and re-installed UE5 just to be sure.

I’d like to specify some interesting points.

  1. The intellisense is not broken within the project solution. I made new files and checked the existing ones, and all intellisense is working. This is of note since the include paths that are not working within the UE5 solution are working within my project solution.
  2. These issues do not happen in UE4

It seems to me that the issue isn’t with intellisense not working, but more that whatever config exists that tells it about the include paths is broken in the UE5 solution?

Adding my voice into the mix, I am also experiencing these issues. Re-generating the project files works for about 2 minutes, but by the time it’s rebuilt the intellisense database my code is back to red squiggle land.

Mine seems to specify the error comes from the class definitions.
image

EDIT: It also appears to mostly only affect Actor files. My function library and static enum classes seem to work completely fine in the .cpp files, but display errors in the .h files.

private void GenerateIntelliSenseData(string[] Arguments, List<Tuple<ProjectFile, ProjectTarget>> Targets)

UBT simple not generated IntelliSenseData for UE5.vcproj

Targets contains only my game project

Bumping, anyone know a fix for this? I am using UE5 precompiled engine with the source files and debug symbol addons. In VS2019 it all worked fine but VS2022 can’t handle it:

It seems random for which files work, Actor.h is b0rked for example but Character.h is fine.

Would be great to find a fix for this as VS2022 has MUCH faster intellisense especially for classes like FVector (where VS2019 would take 30s to give me suggestions)

I have learned that if you add the ‘U’ prefix to the header and .cpp file (probably A for actors), then it will work. Something with the file name is preventing it from getting a proper intellisense output.

It still has an issue with inherited functions. But, this is fine since the suggested list still shows everything appropriately.
image

Would like to see this get fixed.

EDIT: Forgot to mention you must also update the generated.h to include the ‘U’ as a prefix. Then clean the project, and finally rebuild.

2 Likes

Thanks for sharing this.

This engine needs issues like these fixed and for documentation to be significantly improved because the state of this engine is a mess.

2 Likes

hi @adiswa123,
Since looking at the new updates for VS 2022 I have found the section for Tools → Options → Preview Features

There is the function
Enable Indexing for faster find experience

Exit VS2022 and restart open your project you may need to rescan

Update I have tried with my source code version of UE5 using VS2022, NOT THE BINARY AS LOADED BY THE EPIC LAUNCHER, which is BUILT in VS2019, not vs2022
The BINARY is not going the generate Intellisense because it does not run
GenerateProjectFiles.bat, which generates the Intellisense paths and as the post above suggests this somehow has to be called and VS2019 cannot call VS2022 dlls.

Therefore I can go no further as I don’t use UE4 or UE5 BINARIES

In this picture above I added include “Character.h” into Actor.h and it works, but this in the source code build

Seeing as you can work in C++ why don’t you carry out the instructions to build a source copy here
Luoshuang’s GPULightmass Build and run on VS2022

Thanks but these options in the VS preview did not work for me, still get the errors in Actor.h

I’ve filed a bug report with epic last week but no response yet - could be worth more people filing a report!

1 Like

tool → Refresh Visual Studio Project

25 Likes

This seems to fix it!

4 Likes

So I had this same issue, where my project files had Intellisense, but not my Engine Source (I’m using a Local Binary Build built from source). I looked at the UE5.vcxproj in Intermediate/ProjectFiles with Notepad++ and saw that the source include paths were not added for the engine source (the include paths should be in the line that starts with “$(IncludePath) …”).

After running UnrealBuildTool through the debugger, and messing around with it a little bit, found out that if you add the -Engine cmd line argument when generating project files, it will fix the intellisense issues for the engine.

Not sure if this is a feature or a bug, i don’t know why -Engine isn’t automatically specified, but I hope it fixes your problem.

1 Like

This seems to have been stealth fixed in 5.0.3 it seems, at least for the repro I was mentioning :star_struck:

I’ve found that Windows Defender seems to significantly slow down VS syntax highlighting/IntelliSense. Exclusions on VS processes and the folder for the project helps significantly. Bear in mind, there’s security risks in doing this.

Furthermore, compiling in VS2022 and then Right Click → Rescan → Rescan File helps a lot and often solves highlighting problems with things like RPC routines (e.g., UFUNCTIONs marked with Server, NetMulticast, Client - where the implementation has to have _Implementation at the end). With the RPC routines, you must compile before the rescan will solve the highlighting issues with it.

If both of those two things fail and so does refresh VS solution from within Unreal editor top menu bar, then delete the compiled Binaries and rebuild the project whilst Unreal is closed.

One more thing: Hot Reload works better for me on UE5 (5.0.2) than the new Live Coding. If you change header files, close the editor and then compile from VS, then reopen the editor. Sometimes using Hot Reload doesn’t work even when the engine doesn’t crash as well, such as newly compiled binaries not being properly loaded over the old ones, so you’ll want to regularly compile without using Hot Reload anyway. Closing the editor and compiling in VS even if you haven’t made any changes will show you on the Output window that hot reload binaries are being removed, too.

To fix intellisense in VS 2022 (When you generate project files from the right click menu, UE by default add VS2019 project files)

UE4:

  1. Click Edit → Editor Preferences → Source Code
  2. Change Source Code Editor to “Visual Studio 2022”
  3. Click File → Refresh Visual Studio 2022 Project
  4. Click File → Open Visual Studio 2022 to open the project in Visual Studio

UE5:

  1. Click Edit → Editor Preferences → Source Code
  2. Change Source Code Editor to “Visual Studio 2022”
  3. Click Tools → Refresh Visual Studio 2022 Project
  4. Click Tools → Open Visual Studio 2022 to open the project in Visual Studio
24 Likes

Thanks, this was the solution for me

2 Likes

…Great help ! … Thank you …

Thx, this worked

This didn’t work at all for me !

1 Like