Getting placed actors on an unloaded level

Hello,

I am trying to add a data validator to our project with the intention of validating that specific placed actors on certain sublevels are static. We will run this validator when we run the data validation commandlet overnight. I have successfully created and registered the validator, and have added in the logic that will check placed actors’ properties in blueprint, however I am struggling with getting a list of placed actors in an unloaded level. Here is where I’m at:

TArray<ULevelStreaming*> AllStreamingLevelsOnThisMap = World->GetStreamingLevels();
		for (ULevelStreaming* StreamLevel : AllStreamingLevelsOnThisMap)
		{
			ULevel* level = StreamLevel->GetLoadedLevel();
			if (level)
			{
				for (AActor* foundActor : level->Actors)
				{
					FLevelStreamingAndActorPair NewStruct;
					NewStruct.StreamingLevelName = foundActor->GetLevel()->GetOuter()->GetFName();
					NewStruct.Actor = foundActor;
					OutFoundActorsAndLevels.Add(NewStruct);
				}
			}
		}

However, this falls apart pretty quickly, as when I try to run StreamLevel->GetLoadedLevel(), I get a null pointer. I’m guessing this is because the stream level is not loaded when we run the Data Validation commandlet

<ProjectName> -run=DataValidation

What method would you recommend to do to get a list of placed actors on a level that is not currently loaded? Can that even be done, or will I be forced to iterate through all levels and load them before I can verify?

Thanks in advance!

Update: I have also tried the following, but this doesn’t work either, as “GetAllActorsOfClass” also can’t seem to find actors in a level, either:

TArray<AActor*> FoundActors;
	TSubclassOf<AActor> classToFind;
	classToFind = AActor::StaticClass();
	UGameplayStatics::GetAllActorsOfClass(World, classToFind, FoundActors);
	for (AActor* foundActor : FoundActors)
	{
		FLevelStreamingAndActorPair NewStruct;
		NewStruct.StreamingLevelName = foundActor->GetLevel()->GetOuter()->GetFName();
		NewStruct.Actor = foundActor;
		OutFoundActorsAndLevels.Add(NewStruct);
	}

I actually ended up figuring it out myself. I simply got that list from World->PersistentLevel->Actors

for (AActor* Actor : World->PersistentLevel->Actors)
	{
		FLevelStreamingAndActorPair NewStruct;
		NewStruct.StreamingLevelName = Actor->GetLevel()->GetOuter()->GetFName();
		NewStruct.Actor = Actor;
		OutFoundActorsAndLevels.Add(NewStruct);
	}

Feel free to close this question!