For does who struggles with GetWorld

Since the UE4 Udemy course started it’s been some changes in the engine which may not be new to anyone coming this far, since we actually have been notice a fare amount of times. But anyway if your having problems with Unreal Engine 4.22 or maybe even older please add this two includes to ensure that GetWorld doesn’t give you an error:

#include “Engine/World.h”
#include “GameFramework/PlayerController.h”

also remember to remove the UPORPERTY(EditAnywhere) above your AActor if it doesn’t work. If you’re running a newer version of UE4 then of to google ya go

10 Likes

Many thanks for the ‘heads up’ on the required includes, especially the Engine/World.h which was not immediately obvious. IWYU (Include What You Use) may have many advantages but is not very newcomer friendly!

Privacy & Terms