Trying to get actors in game mode overriden method InitGame but getting access violation error with line uncommented.
What I’m doing wrong?
void AGameGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
{
Super::InitGame(MapName, Options, ErrorMessage);
APlayerController * c = UGameplayStatics::GetPlayerController(GetWorld(), 0);
for (TActorIterator<AActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
//c->ClientMessage(ActorItr->GetName());
}
}