Weird behavior with SpawnActor "no instance of overloaded function" in 4.20 using lecture code

For whatever reason in 4.20 with everything exactly as the lecture is done, the SpawnActor call won’t compile with an error:

error C2664: ‘T *UWorld::SpawnActor(UClass *,const FTransform &,const FActorSpawnParameters &)’: cannot convert argument 1 from ‘TSubclassOf’ to ‘const FVector &’
2> with
2> [
2> T=AProjectile
2> ]
2> \Section_04_BattleTank\BattleTank\Source\BattleTank\Private\Tank.cpp(77): note: Reason: cannot convert from ‘TSubclassOf’ to ‘const FVector’
2> \Section_04_BattleTank\BattleTank\Source\BattleTank\Private\Tank.cpp(77): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

I WAS able to work around this by using:

GetWorld()->SpawnActor(ProjectileBlueprint, Barrel->GetSocketTransform(FName(“Projectile”)));

Which seems to be equivalent to the course code.

Privacy & Terms