Once a world has been successfully loaded using the
Load Game World node, you can use the method
Find Viewport World Handle to retrieve the world handle of that loaded world.
Is Viewport World Handle Valid can be used to determine whether a handle is valid or not.
Once you are done with the secondary world, you can simply unload it to free resources.
It is extremely important to unload ONLY when destroying the program widget as shown in the above screenshot in which OnDestroyWidget is automatically called when closing the draggable window. Calling Unload World Handle from anywhere else can potentially crash!
You must use the
Spawn Actor for World Handle function if you want to dynamically spawn an actor inside a secondary world. It is recommended to use this function instead of UWorld::SpawnActor or the native Spawn Actor node.
If the following conditions are met, this function will spawn an actor:
- Actor class is valid.
- World handle is valid.
- World handle has actors initialized. If not initialized, call UViewportWorldStatics::InitializeActorsForWorldHandle.
- World handle has begun play.
Slate widgets can also be added through C++ by calling:
Once you want to remove it, simply call Remove widget from handle function.
Slate widgets can be removed through C++ by calling:
Alternatively, if you want to remove all widgets added to secondary game world viewport just call Clear All Widgets from Handle. This will remove all UMG and Slate widgets added before.