The Actor pointer can be const

Since we don’t change the actor inside the ranged for loop then we can make it a const pointer:

for(const AActor* Actor : Actors)
	{
		FString ActorName = Actor->GetActorNameOrLabel();
		UE_LOG(LogTemp, Display, TEXT("Actor Name %s"), *ActorName);
	}

Privacy & Terms