GetWorld not working with intellisense

When I use GetWorld()-> in my code it compiles and runs fine. However, it won’t give me the intellisense drop down menu to show possible options that would follow GetWorld and there is a red squiggly line under GetWorld. I am fairly new to coding, so if you do happen to know the solution please provide it in a simplified matter or if you could thoroughly explain why this is happening and its solution.

Any help is greatly appreciated, thank you!

Some classes such as AActor have access to GetWorld() by default, while others do not. If Intellisense complains about it, you will need to include a header file at the top of your .cpp file to get access to it.

I think the code still works without this, but I believe the need for the header file for Intellisense came along in a relatively recent patch where many headers were no longer included by default so that it would only have to read the files that are actually being used.

Anyway, this is the line you need at the top of your .cpp file:

#include "Engine/World.h"

Thank you, that fixed it!