RealDocs

UGameplayStatics::LoadStreamLevelBySoftObjectPtr

function Engine Blueprint Since 4.18
#include "Kismet/GameplayStatics.h"
Access: public Specifiers: staticUFUNCTIONBlueprintCallable

Description

Streams a sub-level into the world using a soft object reference rather than a name string, making it refactor-safe and easier to use in data-driven systems. Preferred over the name-based version when the level reference can be held as an asset pointer.

Caveats & Gotchas

  • The TSoftObjectPtr must resolve to a valid UWorld asset. If the pointer is null or the asset is missing from the project, the function silently does nothing and the latent callback never fires.
  • Like the name-based variant, calling this while a load is already in progress for the same level has no effect — the existing load continues and the new callback is dropped.
  • Soft object pointers pointing to levels in different world partition setups may resolve unexpectedly if the level has been renamed or moved in the content browser without updating all references.

Signature

static ENGINE_API void LoadStreamLevelBySoftObjectPtr(const UObject* WorldContextObject, const TSoftObjectPtr<UWorld> Level, bool bMakeVisibleAfterLoad, bool bShouldBlockOnLoad, FLatentActionInfo LatentInfo);

Parameters

Name Type Description Default
WorldContextObject const UObject* Any object in the world to use as context.
Level const TSoftObjectPtr<UWorld> A soft object reference to the UWorld asset to stream in.
bMakeVisibleAfterLoad bool If true, the level is made visible immediately after loading completes.
bShouldBlockOnLoad bool If true, the game thread blocks until the level is fully loaded.
LatentInfo FLatentActionInfo Latent action callback info used by Blueprint to resume execution after load.

Return Type

void

Example

Stream a level referenced as a soft pointer C++
// In your class: TSoftObjectPtr<UWorld> SubLevelRef;
FLatentActionInfo LatentInfo;
LatentInfo.CallbackTarget = this;
LatentInfo.ExecutionFunction = FName("OnSubLevelLoaded");
LatentInfo.Linkage = 0;
LatentInfo.UUID = 2;
UGameplayStatics::LoadStreamLevelBySoftObjectPtr(this, SubLevelRef, true, false, LatentInfo);

Version History

Introduced in: 4.18

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.