UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FWorldContext Struct Reference

#include <Engine.h>

Public Member Functions

void AddRef (UWorld *&WorldPtr)
 
void AddRef (TObjectPtr< UWorld > &WorldPtr)
 
void RemoveRef (UWorld *&WorldPtr)
 
ENGINE_API void SetCurrentWorld (UWorld *World)
 
void AddReferencedObjects (FReferenceCollector &Collector, const UObject *ReferencingObject)
 
UWorldWorld () const
 
 FWorldContext ()
 

Public Attributes

TEnumAsByte< EWorldType::TypeWorldType
 
FSeamlessTravelHandler SeamlessTravelHandler
 
FName ContextHandle
 
FString TravelURL
 
uint8 TravelType
 
struct FURL LastURL
 
struct FURL LastRemoteURL
 
TObjectPtr< UPendingNetGamePendingNetGame
 
TArray< struct FFullyLoadedPackagesInfoPackagesToFullyLoad
 
TArray< FNameLevelsToLoadForPendingMapChange
 
TArray< TObjectPtr< class ULevel > > LoadedLevelsForPendingMapChange
 
FString PendingMapChangeFailureDescription
 
uint32 bShouldCommitPendingMapChange:1
 
TArray< TObjectPtr< class UObjectReferencer > > ObjectReferencers
 
TArray< struct FLevelStreamingStatusPendingLevelStreamingStatusUpdates
 
TObjectPtr< class UGameViewportClientGameViewport
 
TObjectPtr< class UGameInstanceOwningGameInstance
 
TArray< FNamedNetDriverActiveNetDrivers
 
int32 PIEInstance
 
FString PIEPrefix
 
ERHIFeatureLevel::Type PIEWorldFeatureLevel
 
bool RunAsDedicated
 
bool bWaitingOnOnlineSubsystem
 
bool bIsPrimaryPIEInstance
 
uint32 AudioDeviceID
 
FString CustomDescription
 
float PIEFixedTickSeconds = 0.f
 
float PIEAccumulatedTickSeconds = 0.f
 
TSet< FObjectKeyGarbageObjectsToVerify
 
TArray< TObjectPtr< UWorld > * > ExternalReferences
 

Detailed Description

FWorldContext A context for dealing with UWorlds at the engine level. As the engine brings up and destroys world, we need a way to keep straight what world belongs to what.

WorldContexts can be thought of as a track. By default we have 1 track that we load and unload levels on. Adding a second context is adding a second track; another track of progression for worlds to live on.

For the GameEngine, there will be one WorldContext until we decide to support multiple simultaneous worlds. For the EditorEngine, there may be one WorldContext for the EditorWorld and one for the PIE World.

FWorldContext provides both a way to manage 'the current PIE UWorld*' as well as state that goes along with connecting/travelling to new worlds.

FWorldContext should remain internal to the UEngine classes. Outside code should not keep pointers or try to manage FWorldContexts directly. Outside code can still deal with UWorld*, and pass UWorld*s into Engine level functions. The Engine code can look up the relevant context for a given UWorld*.

For convenience, FWorldContext can maintain outside pointers to UWorld*s. For example, PIE can tie UWorld* UEditorEngine::PlayWorld to the PIE world context. If the PIE UWorld changes, the UEditorEngine::PlayWorld pointer will be automatically updated. This is done with AddRef() and SetCurrentWorld().

Constructor & Destructor Documentation

◆ FWorldContext()

FWorldContext::FWorldContext ( )
inline

Member Function Documentation

◆ AddRef() [1/2]

void FWorldContext::AddRef ( TObjectPtr< UWorld > &  WorldPtr)
inline

◆ AddRef() [2/2]

void FWorldContext::AddRef ( UWorld *&  WorldPtr)
inline

Adds an external reference

◆ AddReferencedObjects()

void FWorldContext::AddReferencedObjects ( FReferenceCollector Collector,
const UObject ReferencingObject 
)

Collect FWorldContext references for garbage collection

◆ RemoveRef()

void FWorldContext::RemoveRef ( UWorld *&  WorldPtr)
inline

Removes an external reference

◆ SetCurrentWorld()

void FWorldContext::SetCurrentWorld ( UWorld World)

Set CurrentWorld and update external reference pointers to reflect this

◆ World()

UWorld * FWorldContext::World ( ) const
inline

Member Data Documentation

◆ ActiveNetDrivers

TArray<FNamedNetDriver> FWorldContext::ActiveNetDrivers

A list of active net drivers

◆ AudioDeviceID

uint32 FWorldContext::AudioDeviceID

Handle to this world context's audio device.

◆ bIsPrimaryPIEInstance

bool FWorldContext::bIsPrimaryPIEInstance

Is this the 'primary' PIE instance. Primary is preferred when, for example, unique hardware like a VR headset can be used by only one PIE instance.

◆ bShouldCommitPendingMapChange

uint32 FWorldContext::bShouldCommitPendingMapChange

If true, commit map change the next frame.

◆ bWaitingOnOnlineSubsystem

bool FWorldContext::bWaitingOnOnlineSubsystem

Is this world context waiting for an online login to complete (for PIE)

◆ ContextHandle

FName FWorldContext::ContextHandle

◆ CustomDescription

FString FWorldContext::CustomDescription

Custom description to be display in blueprint debugger UI

◆ ExternalReferences

TArray<TObjectPtr<UWorld>*> FWorldContext::ExternalReferences

Outside pointers to CurrentWorld that should be kept in sync if current world changes

◆ GameViewport

TObjectPtr<class UGameViewportClient> FWorldContext::GameViewport

◆ GarbageObjectsToVerify

TSet<FObjectKey> FWorldContext::GarbageObjectsToVerify

On a transition to another level (e.g. LoadMap), the engine will verify that these objects have been cleaned up by garbage collection

◆ LastRemoteURL

struct FURL FWorldContext::LastRemoteURL

last server we connected to (for "reconnect" command)

◆ LastURL

struct FURL FWorldContext::LastURL

URL the last time we traveled

◆ LevelsToLoadForPendingMapChange

TArray<FName> FWorldContext::LevelsToLoadForPendingMapChange

Array of package/ level names that need to be loaded for the pending map change. First level in that array is going to be made a fake persistent one by using ULevelStreamingPersistent.

◆ LoadedLevelsForPendingMapChange

TArray<TObjectPtr<class ULevel> > FWorldContext::LoadedLevelsForPendingMapChange

Array of already loaded levels. The ordering is arbitrary and depends on what is already loaded and such.

◆ ObjectReferencers

TArray<TObjectPtr<class UObjectReferencer> > FWorldContext::ObjectReferencers

Handles to object references; used by the engine to e.g. the prevent objects from being garbage collected.

◆ OwningGameInstance

TObjectPtr<class UGameInstance> FWorldContext::OwningGameInstance

◆ PackagesToFullyLoad

TArray<struct FFullyLoadedPackagesInfo> FWorldContext::PackagesToFullyLoad

A list of tag/array pairs that is used at LoadMap time to fully load packages that may be needed for the map/game with DLC, but we can't use DynamicLoadObject to load from the packages

◆ PendingLevelStreamingStatusUpdates

TArray<struct FLevelStreamingStatus> FWorldContext::PendingLevelStreamingStatusUpdates

◆ PendingMapChangeFailureDescription

FString FWorldContext::PendingMapChangeFailureDescription

Human readable error string for any failure during a map change request. Empty if there were no failures.

◆ PendingNetGame

TObjectPtr<UPendingNetGame> FWorldContext::PendingNetGame

◆ PIEAccumulatedTickSeconds

float FWorldContext::PIEAccumulatedTickSeconds = 0.f

◆ PIEFixedTickSeconds

float FWorldContext::PIEFixedTickSeconds = 0.f

◆ PIEInstance

int32 FWorldContext::PIEInstance

The PIE instance of this world, -1 is default

◆ PIEPrefix

FString FWorldContext::PIEPrefix

The Prefix in front of PIE level names, empty is default

◆ PIEWorldFeatureLevel

ERHIFeatureLevel::Type FWorldContext::PIEWorldFeatureLevel

The feature level that PIE world should use

◆ RunAsDedicated

bool FWorldContext::RunAsDedicated

Is this running as a dedicated server

◆ SeamlessTravelHandler

FSeamlessTravelHandler FWorldContext::SeamlessTravelHandler

◆ TravelType

uint8 FWorldContext::TravelType

TravelType for pending client connects

◆ TravelURL

FString FWorldContext::TravelURL

URL to travel to for pending client connect

◆ WorldType

TEnumAsByte<EWorldType::Type> FWorldContext::WorldType

The documentation for this struct was generated from the following files: