How to verify ULevelStreaming async progress?

Is there a way to check the progress of the async level streaming once you add the ULevelStreaming to the World’s StreamingLevels?

In the source code for the Open Stream Level function, they use a LatentAction and point to a function when the Action is complete as a way to get a callback, but what if you don’t use LatentAction for level streaming and instead just initialize a ULevelStreaming and add it to the World’s SteamingLevels array? Is there no way to query for the progress?

 ULevelStreamingKismet* StreamingLevel = NewObject<ULevelStreamingKismet>((UObject*)GetTransientPackage(), ULevelStreamingKismet::StaticClass());

// etc etc

StreamingLevel->bShouldBeLoaded = true;
StreamingLevel->bShouldBeVisible = true;
StreamingLevel->bShouldBlockOnLoad = false;
StreamingLevel->bInitiallyLoaded = true;
StreamingLevel->bInitiallyVisible = true;

// more code

World->StreamingLevels.Add(StreamingLevel);

You can add delegates to ULevelStreamingKismet that will inform you about a lot of events regarding the StreamingLevel:

  • OnLevelLoaded
  • OnLevelUnloaded
  • OnLevelShown
  • OnLevelHidden

Your code would be something like this:

ULevelStreamingKismet* StreamingLevel = NewObject<ULevelStreamingKismet>((UObject*)GetTransientPackage(), ULevelStreamingKismet::StaticClass());

// Add delegates
StreamingLevel->OnLevelLoaded.AddDynamic(this, &AMyActor::OnLevelLoaded);

StreamingLevel->bShouldBeLoaded = true;
StreamingLevel->bShouldBeVisible = true;
StreamingLevel->bShouldBlockOnLoad = false;
StreamingLevel->bInitiallyLoaded = true;
StreamingLevel->bInitiallyVisible = true;

World->StreamingLevels.Add(StreamingLevel);

Note: Your callbacks must be UFUNCTIONs too.

Okay so I would have found this on my own definitely … tell me if I’m looking at the wrong reference?

Why is there no functions or variables available in the documentation here?

Yeah the documentation is quite hidden, the best option as always is to check the actual engine source code (it’s always ahead the documentation).

Here is the loaded event in the documentation: OnLevelLoaded | Unreal Engine Documentation

Could you reaccept the answer? It get’s unaccepted once I add this comment xD