I recently upgraded to 4.18 from 4.15. I have now encountered a problem with the TActorIterator, only inside AMyPlayerController it seems.
The error I get looks like this:
void AMyPlayerController::BeginPlayingState() {
Super::BeginPlayingState();
AMyTank* NewTank = Cast<AMyTank>(GetPawn());
for (TActorIterator<AMyTank> TankIt(GetWorld()); TankIt; ++TankIt) {
//Body
}
}
There is an error when I try to do TActorIterator with the following error log:
2>c:\program files\epic games\ue_4.18\engine\source\runtime\engine\public\EngineUtils.h(490): error C2664: 'TActorIteratorBase<TActorIterator<AMyTank>>::TActorIteratorBase(TActorIteratorBase<TActorIterator<AMyTank>> &&)': cannot convert argument 2 from 'TSubclassOf<AMyTank>' to 'TSubclassOf<AActor>'
2> c:\program files\epic games\ue_4.18\engine\source\runtime\engine\public\EngineUtils.h(490): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
2> c:\program files\epic games\ue_4.18\engine\source\runtime\engine\public\EngineUtils.h(488): note: while compiling class template member function 'TActorIterator<AMyTank>::TActorIterator(UWorld *,TSubclassOf<AMyTank>,EActorIteratorFlags)'
2> C:\..\..\Player\MyPlayerController.cpp(426): note: see reference to function template instantiation 'TActorIterator<AMyTank>::TActorIterator(UWorld *,TSubclassOf<AMyTank>,EActorIteratorFlags)' being compiled
2> C:\..\..\\MainFiles\Source\PC\Player\MyPlayerController.cpp(426): note: see reference to class template instantiation 'TActorIterator<AMyTank>' being compiled
I did this same function in another class, in a class that extends UMG Widget, and it worked fine as of now - sometimes it didn’t work either, but it seems to consistently work now. But, now the error happens in this custom Player Controller class. If anyone has any information about this, I am all ears.