![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#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) |
| UWorld * | World () const |
| FWorldContext () | |
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().
|
inline |
|
inline |
| void FWorldContext::AddReferencedObjects | ( | FReferenceCollector & | Collector, |
| const UObject * | ReferencingObject | ||
| ) |
Collect FWorldContext references for garbage collection
Set CurrentWorld and update external reference pointers to reflect this
|
inline |
| TArray<FNamedNetDriver> FWorldContext::ActiveNetDrivers |
A list of active net drivers
| uint32 FWorldContext::AudioDeviceID |
Handle to this world context's audio device.
| 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.
| uint32 FWorldContext::bShouldCommitPendingMapChange |
If true, commit map change the next frame.
| bool FWorldContext::bWaitingOnOnlineSubsystem |
Is this world context waiting for an online login to complete (for PIE)
| FName FWorldContext::ContextHandle |
| FString FWorldContext::CustomDescription |
Custom description to be display in blueprint debugger UI
| TArray<TObjectPtr<UWorld>*> FWorldContext::ExternalReferences |
Outside pointers to CurrentWorld that should be kept in sync if current world changes
| TObjectPtr<class UGameViewportClient> FWorldContext::GameViewport |
| 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
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.
| TArray<TObjectPtr<class ULevel> > FWorldContext::LoadedLevelsForPendingMapChange |
Array of already loaded levels. The ordering is arbitrary and depends on what is already loaded and such.
| TArray<TObjectPtr<class UObjectReferencer> > FWorldContext::ObjectReferencers |
Handles to object references; used by the engine to e.g. the prevent objects from being garbage collected.
| TObjectPtr<class UGameInstance> FWorldContext::OwningGameInstance |
| 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
| TArray<struct FLevelStreamingStatus> FWorldContext::PendingLevelStreamingStatusUpdates |
| FString FWorldContext::PendingMapChangeFailureDescription |
Human readable error string for any failure during a map change request. Empty if there were no failures.
| TObjectPtr<UPendingNetGame> FWorldContext::PendingNetGame |
| float FWorldContext::PIEAccumulatedTickSeconds = 0.f |
| float FWorldContext::PIEFixedTickSeconds = 0.f |
| int32 FWorldContext::PIEInstance |
The PIE instance of this world, -1 is default
| FString FWorldContext::PIEPrefix |
The Prefix in front of PIE level names, empty is default
| ERHIFeatureLevel::Type FWorldContext::PIEWorldFeatureLevel |
The feature level that PIE world should use
| bool FWorldContext::RunAsDedicated |
Is this running as a dedicated server
| FSeamlessTravelHandler FWorldContext::SeamlessTravelHandler |
| uint8 FWorldContext::TravelType |
TravelType for pending client connects
| FString FWorldContext::TravelURL |
URL to travel to for pending client connect
| TEnumAsByte<EWorldType::Type> FWorldContext::WorldType |