I am coming from Unity and have an intermediate understanding of C# but very little of C++. I am going through he Battery Collector tutorial and I am having a problem with the GetWorldTimerManager().SetTimer part. I understand the IWYU concept and I also understand this is more than likely an include I am missing but I cannot figure it out.
First the problem
void ASpawnVolume::BeginPlay()
{
Super::BeginPlay();
spawnDelay = FMath::FRandRange(spawnDelayRangeLow, spawnDelayRangeHigh);
GetWorldTimerManager().SetTimer(spawnTimer, this, &ASpawnVolume::SpawnPickup, spawnDelay, false);
}
Visual Studio says GetWorldTimerManager is an incomplete type. As I understand this is a class that is not fully complied yet so the compiler doesn’t know what to do.
Second my current resolution.
If I throw out IWYU and #include “Engine.h” the error goes away and the project compiles very slowly but it does compile and VS has no error. I don’t like this solution as it is adding a large amount of modules I don’t need. Unreal added IWYU for a reason.
TLDR I need to know what files to include when using GetWorldTimerManager from a class derived from AActor.
Thanks in advance for any support you may offer.