We have functions
void UGameplayStatics::GetAllActorsOfClass(const UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, TArray<AActor*>& OutActors)
APawn* UGameplayStatics::GetPlayerPawn(const UObject* WorldContextObject, int32 PlayerIndex)
Both needed an argument UObject* WorldContextObject
But our implementation is
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APawnTurret::StaticClass(), TurretActors);
PlayerTank = Cast<APawnTank>(UGameplayStatics::GetPlayerPawn(this, 0));
Why in first case we use GetWorld()
and in second this
?
For safety I ask one more thing. What return this
for “ProjectileBase” actor, “PawnBase” pawn, derived pawn “PawnTank” , “HealthComponent” component, “TankGameModeBase” Game mode?