UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FScopedLevelCollectionContextSwitch Class Reference

#include <World.h>

Public Member Functions

UE_API FScopedLevelCollectionContextSwitch (const FLevelCollection *const InLevelCollection, UWorld *const InWorld)
 
UE_API FScopedLevelCollectionContextSwitch (int32 InLevelCollectionIndex, UWorld *const InWorld)
 
UE_API ~FScopedLevelCollectionContextSwitch ()
 

Detailed Description

A helper RAII class to set the relevant context on a UWorld for a particular FLevelCollection within a scope. The constructor will set the PersistentLevel, GameState, NetDriver, and DemoNetDriver on the world and the destructor will restore the original values.

Constructor & Destructor Documentation

◆ FScopedLevelCollectionContextSwitch() [1/2]

FScopedLevelCollectionContextSwitch::FScopedLevelCollectionContextSwitch ( const FLevelCollection *const  InLevelCollection,
UWorld *const  InWorld 
)

Constructor that will save the current relevant values of InWorld and set the collection's context values for InWorld. The constructor that takes an index is preferred, but this one still exists for backwards compatibility.

Parameters
InLevelCollectionThe collection's context to use
InWorldThe world on which to set the context.

◆ FScopedLevelCollectionContextSwitch() [2/2]

FScopedLevelCollectionContextSwitch::FScopedLevelCollectionContextSwitch ( int32  InLevelCollectionIndex,
UWorld *const  InWorld 
)

Constructor that will save the current relevant values of InWorld and set the collection's context values for InWorld.

Parameters
InLevelCollectionIndexThe index of the collection to use
InWorldThe world on which to set the context.

◆ ~FScopedLevelCollectionContextSwitch()

FScopedLevelCollectionContextSwitch::~FScopedLevelCollectionContextSwitch ( )

The destructor restores the context on the world that was saved in the constructor.


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