FWorldContext

[FWorldContext](API\Runtime\Engine\Engine\FWorldContext) A context for dealing with UWorlds at the engine level.

Windows
MacOS
Linux

Syntax

struct FWorldContext

Remarks

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](API\Editor\UnrealEd\Editor\UEditorEngine\PlayWorld) to the PIE world context. If the PIE UWorld changes, the [UEditorEngine::PlayWorld](API\Editor\UnrealEd\Editor\UEditorEngine\PlayWorld) pointer will be automatically updated. This is done with AddRef() and SetCurrentWorld().

Variables

Name Description

Public variable

TArray< FNamedN...

 

ActiveNetDrivers

A list of active net drivers

Public variable

uint32

 

AudioDeviceHandle

Handle to this world context's audio device.

Public variable

uint32: 1

 

bShouldCommitPendingMapChange

If true, commit map change the next frame.

Public variable

bool

 

bWaitingOnOnlineSubsystem

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

Public variable

FName

 

ContextHandle

Public variable

TArray< UWorld ...

 

ExternalReferences

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

Public variable

UGameViewportCl...

 

GameViewport

Public variable

FURL

 

LastRemoteURL

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

Public variable

FURL

 

LastURL

URL the last time we traveled

Public variable

TArray< FName >

 

LevelsToLoadForPendingMapChange

Array of package/ level names that need to be loaded for the pending map change.

Public variable

TArray< class U...

 

LoadedLevelsForPendingMapChange

Array of already loaded levels.

Public variable

TArray< class U...

 

ObjectReferencers

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

Public variable

UGameInstance &...

 

OwningGameInstance

Public variable

TArray< struct ...

 

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

Public variable

TArray< struct ...

 

PendingLevelStreamingStatusUpdates

Public variable

FString

 

PendingMapChangeFailureDescription

Human readable error string for any failure during a map change request.

Public variable

UPendingNetGame...

 

PendingNetGame

Public variable

int32

 

PIEInstance

The PIE instance of this world, -1 is default

Public variable

FString

 

PIEPrefix

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

Public variable

ERHIFeatureLeve...

 

PIEWorldFeatureLevel

The feature level that PIE world should use

Public variable

bool

 

RunAsDedicated

Is this running as a dedicated server

Public variable

FSeamlessTravel...

 

SeamlessTravelHandler

Public variable

uint8

 

TravelType

TravelType for pending client connects

Public variable

FString

 

TravelURL

URL to travel to for pending client connect

Public variable

TEnumAsByte< EW...

 

WorldType

Constructors

Name Description

Public function

FWorldContext()

Functions

Name Description

Public function

void

 

AddRef

(
    UWorld*& WorldPtr
)

Adds an external reference

Public function

void

 

AddReferencedObjects

(
    FReferenceCollector& Collector,
    const UObject* ReferencingObje...
)

Collect FWorldContext references for garbage collection

Public function

void

 

RemoveRef

(
    UWorld*& WorldPtr
)

Removes an external reference

Public function

void

 

SetCurrentWorld

(
    UWorld* World
)

Set CurrentWorld and update external reference pointers to reflect this

Public function Const

UWorld *

 

World()

References

Module

Engine

Header

Runtime/Engine/Classes/Engine/Engine.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback