RealDocs

UGameplayStatics::OpenLevelBySoftObjectPtr

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

Description

Performs a full level travel to a world asset specified by a soft object pointer, offering type-safe level navigation compared to the name-based OpenLevel. The current world is unloaded and the target world is loaded.

Caveats & Gotchas

  • Like all OpenLevel variants, this triggers a full world teardown. All actors, subsystems, and game state are destroyed. There is no way to cancel the travel once initiated.
  • The soft object pointer is resolved at call time. If the asset is not yet loaded or is invalid, the travel will fail silently with no error callback.
  • Options strings follow the UE travel URL convention (key=value pairs separated by '?'). Malformed option strings may be silently ignored or cause the travel to behave unexpectedly on the receiving level.

Signature

static ENGINE_API void OpenLevelBySoftObjectPtr(const UObject* WorldContextObject, const TSoftObjectPtr<UWorld> Level, bool bAbsolute = true, FString Options = FString(TEXT("")));

Parameters

Name Type Description Default
WorldContextObject const UObject* Any object in the world to use as context.
Level const TSoftObjectPtr<UWorld> Soft reference to the UWorld asset to travel to.
bAbsolute bool If true, options are reset and a full travel occurs. If false, current options are carried over. true
Options FString Optional URL options string appended to the travel URL (e.g. '?listen'). FString(TEXT(""))

Return Type

void

Example

Travel to a level referenced as a soft pointer with listen server option C++
// In your class header: TSoftObjectPtr<UWorld> NextLevelRef;
UGameplayStatics::OpenLevelBySoftObjectPtr(this, NextLevelRef, true, FString(TEXT("?listen")));

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.