FViewportWorldHandle
#include <ViewportWorlds/Public/ViewportWorldTypes.h>Collaboration diagram
Section titled “Collaboration diagram”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class FViewportWorldHandle["FViewportWorldHandle"]
class SViewportWorld["SViewportWorld"]
FViewportWorldHandle *-- SViewportWorld
Class detail
Section titled “Class detail”---
config:
class:
hideEmptyMembersBox: true
---
classDiagram
class FViewportWorldHandle {
+ViewportWorldWidget : TWeakPtr< SViewportWorld() >
+LocalPlayer : TObjectPtr< ULocalPlayer >
+WorldContext : FWorldContext *
+BaseURL : FURL
+OnWorldUnloadedDelegate : FOnWorldUnloadedDelegate()
+ParentWindow : TWeakPtr< SWindow >
+InitializeActors()
+WorldBeginPlay()
+Reset()
+IsHandleValid() const bool
+WorldIsReady() const bool
+FViewportWorldHandle()
+FViewportWorldHandle(FWorldContext &WorldContext, const FURL &Ba
+bActorsInitialized : uint8
+bWorldHasBegunPlay : uint8
}
Caller impact — IsHandleValid
Section titled “Caller impact — IsHandleValid”Documented call sites inside the plugin (10):
flowchart LR FViewportWorldHandle__IsHandleValid["FViewportWorldHandle::IsHandleValid"] UViewportWorldSubsystem__AddSlateWidgetToViewport["UViewportWorldSubsystem::AddSlateWidgetToViewport"] UViewportWorldSubsystem__AddSlateWidgetToViewport --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__ExecuteCommandForHandle["UViewportWorldStatics::ExecuteCommandForHandle"] UViewportWorldStatics__ExecuteCommandForHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__FindViewportWorldHandle["UViewportWorldStatics::FindViewportWorldHandle"] UViewportWorldStatics__FindViewportWorldHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__GetGameModeFromHandle["UViewportWorldStatics::GetGameModeFromHandle"] UViewportWorldStatics__GetGameModeFromHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__GetGameStateFromHandle["UViewportWorldStatics::GetGameStateFromHandle"] UViewportWorldStatics__GetGameStateFromHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__IsViewportWorldHandleValid["UViewportWorldStatics::IsViewportWorldHandleValid"] UViewportWorldStatics__IsViewportWorldHandleValid --> FViewportWorldHandle__IsHandleValid UViewportWorldWidget__LoadGameWorld["UViewportWorldWidget::LoadGameWorld"] UViewportWorldWidget__LoadGameWorld --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__SetWorldTickForHandle["UViewportWorldStatics::SetWorldTickForHandle"] UViewportWorldStatics__SetWorldTickForHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldSubsystem__UnloadWorldHandle["UViewportWorldSubsystem::UnloadWorldHandle"] UViewportWorldSubsystem__UnloadWorldHandle --> FViewportWorldHandle__IsHandleValid UViewportWorldStatics__UpdateViewMode["UViewportWorldStatics::UpdateViewMode"] UViewportWorldStatics__UpdateViewMode --> FViewportWorldHandle__IsHandleValid
struct FViewportWorldHandleDefined in ViewportWorldTypes.h:40 Represents a handle to a viewport world.
Public Attributes
Section titled “Public Attributes”| Return | Name | Description |
|---|---|---|
TWeakPtr< SViewportWorld > | ViewportWorldWidget | Weak pointer to track a SViewportWorld widget in a viewport. |
TObjectPtr< ULocalPlayer > | LocalPlayer | |
FWorldContext * | WorldContext | The FWorldContext structure is used to store information about the world in a viewport. It is used in various operations within the viewport world, such as spawning actors, updating view modes, setting the tick enabled state, and executing commands. |
FURL | BaseURL | The FURL structure contains information about a URL, including the protocol, host, port, map, and options. |
FOnWorldUnloadedDelegate | OnWorldUnloadedDelegate | Delegate called when a world is unloaded. |
TWeakPtr< SWindow > | ParentWindow |
ViewportWorldWidget
Section titled “ViewportWorldWidget”TWeakPtr< SViewportWorld > ViewportWorldWidgetDefined in ViewportWorldTypes.h:45 Weak pointer to track a SViewportWorld widget in a viewport.
Referenced by
Section titled “Referenced by”LocalPlayer
Section titled “LocalPlayer”TObjectPtr< ULocalPlayer > LocalPlayerDefined in ViewportWorldTypes.h:48
Referenced by
Section titled “Referenced by”WorldContext
Section titled “WorldContext”FWorldContext * WorldContextDefined in ViewportWorldTypes.h:54 The FWorldContext structure is used to store information about the world in a viewport. It is used in various operations within the viewport world, such as spawning actors, updating view modes, setting the tick enabled state, and executing commands.
Referenced by
Section titled “Referenced by”ExecuteCommandForHandleGetGameModeFromHandleGetGameStateFromHandleInitializeActorsInitializeViewportWorldInternal_LoadWorldResetSetWorldTickForHandleSpawnActorForWorldHandleUnloadWorldHandleUpdateViewModeWorldBeginPlay
BaseURL
Section titled “BaseURL”FURL BaseURLDefined in ViewportWorldTypes.h:57 The FURL structure contains information about a URL, including the protocol, host, port, map, and options.
Referenced by
Section titled “Referenced by”OnWorldUnloadedDelegate
Section titled “OnWorldUnloadedDelegate”FOnWorldUnloadedDelegate OnWorldUnloadedDelegateDefined in ViewportWorldTypes.h:65 Delegate called when a world is unloaded.
The OnWorldUnloadedDelegate is a delegate that can be bound to a function and called when a world is unloaded. It is used in the FViewportWorldHandle structure to track the unloading of a world.
Referenced by
Section titled “Referenced by”ParentWindow
Section titled “ParentWindow”TWeakPtr< SWindow > ParentWindowDefined in ViewportWorldTypes.h:67
Referenced by
Section titled “Referenced by”Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
void | InitializeActors | Initializes the actors in the viewport world. |
void | WorldBeginPlay | Calls the BeginPlay function on the world associated with the viewport world handle. |
void | Reset | Resets the FViewportWorldHandle to its default state. |
bool | IsHandleValid const inline | Checks if the handle is valid. |
bool | WorldIsReady const inline | Checks if the world is ready for use. This method checks if the handle is valid, if the actors have been initialized, and if the world has begun play. |
FViewportWorldHandle inline | Default constructor | |
FViewportWorldHandle inline | Constructs a new handle from the given parameters. |
InitializeActors
Section titled “InitializeActors”void InitializeActors()Defined in ViewportWorldTypes.h:83 Initializes the actors in the viewport world.
This method initializes the actors in the viewport world by calling the InitializeActorsForPlay method of the world associated with the viewport. If the actors have already been initialized or if the world context or world associated with the viewport is invalid, this method does nothing.
This method should be called before beginning play in the viewport world.
Referenced by
Section titled “Referenced by”References
Section titled “References”bActorsInitializedBaseURLVerboseWorldContext
WorldBeginPlay
Section titled “WorldBeginPlay”void WorldBeginPlay()Defined in ViewportWorldTypes.h:98 Calls the BeginPlay function on the world associated with the viewport world handle.
This function should be called after initializing actors in the viewport world. If the actors have not been initialized or if the world context or world associated with the handle is invalid, this function does nothing.
This function also spawns the player actors for the local players in the viewport world. It calls the SpawnPlayActor function on each local player in the owning game instance of the world context, passing the base URL and the world context’s world as parameters.
After that, it calls the BeginPlay function on the world associated with the world context.
Referenced by
Section titled “Referenced by”References
Section titled “References”bActorsInitializedBaseURLbWorldHasBegunPlayVerboseWarningWorldContext
void Reset()Defined in ViewportWorldTypes.h:111 Resets the FViewportWorldHandle to its default state.
This method detaches the viewport client from the game viewport, resets the game viewport to nullptr, sets the current world to nullptr, and sets the world context to nullptr.
It also resets the viewport world widget, the local player, the base URL, and unbinds the OnWorldUnloadedDelegate. Finally, it sets the bActorsInitialized and bWorldHasBegunPlay flags to false.
This method does not destroy any objects or deallocate any memory. It simply resets the state of the FViewportWorldHandle.
Referenced by
Section titled “Referenced by”References
Section titled “References”bActorsInitializedBaseURLbWorldHasBegunPlayLocalPlayerOnWorldUnloadedDelegateParentWindowViewportWorldWidgetWorldContext
IsHandleValid
Section titled “IsHandleValid”const inline
inline bool IsHandleValid() constDefined in ViewportWorldTypes.h:121 Checks if the handle is valid.
This method checks if the handle is valid by verifying that the WorldContext is not nullptr and that the WorldContext’s World is valid using the IsValid() function.
Returns
Section titled “Returns”true if the handle is valid, false otherwise.
Referenced by
Section titled “Referenced by”AddSlateWidgetToViewportExecuteCommandForHandleFindViewportWorldHandleGetGameModeFromHandleGetGameStateFromHandleIsViewportWorldHandleValidLoadGameWorldSetWorldTickForHandleUnloadWorldHandleUpdateViewMode
WorldIsReady
Section titled “WorldIsReady”const inline
inline bool WorldIsReady() constDefined in ViewportWorldTypes.h:129 Checks if the world is ready for use. This method checks if the handle is valid, if the actors have been initialized, and if the world has begun play.
Returns
Section titled “Returns”true if the world is ready, false otherwise.
Referenced by
Section titled “Referenced by”FViewportWorldHandle
Section titled “FViewportWorldHandle”inline
inline FViewportWorldHandle()Defined in ViewportWorldTypes.h:144 Default constructor
FViewportWorldHandle
Section titled “FViewportWorldHandle”inline
inline FViewportWorldHandle(FWorldContext & WorldContext, const FURL & BaseURL)Defined in ViewportWorldTypes.h:154 Constructs a new handle from the given parameters.
Private Attributes
Section titled “Private Attributes”| Return | Name | Description |
|---|---|---|
uint8 | bActorsInitialized | |
uint8 | bWorldHasBegunPlay |
bActorsInitialized
Section titled “bActorsInitialized”uint8 bActorsInitializedDefined in ViewportWorldTypes.h:70
Referenced by
Section titled “Referenced by”bWorldHasBegunPlay
Section titled “bWorldHasBegunPlay”uint8 bWorldHasBegunPlayDefined in ViewportWorldTypes.h:71