Search
Start typing to search...

Switching Scenes with Levels

Author:

Introduction

In Unreal Engine, a level—also referred to as a map—is a collection of assets and actors, such as objects, characters, lights, and geometry. These elements are usually arranged in the level to create a visual experience, such as a virtual studio scene. Levels are created in the Unreal Editor, where the elements of a level populate the Outliner panel.

If you have different virtual studio scenes and you want to switch between them during production without one scene being visible from another, having multiple levels can segregate the assets of each scene. This approach reduces hardware load compared to having all assets in a single level. Additionally, designing individual levels becomes easier because assets from other levels are not visible and do not interfere with the editing process.

Below, we will discuss two methods for switching between levels during live production:

  • Level Switch with Open Level: Although this method causes interruptions and frame drops, it can be easier to manage in the Unreal Editor when working with many levels and requires simpler blueprint logic. When using a multi-machine setup, this method can still provide a seamless transition.
  • Level Switch with Stream Level: This method is recommended for seamless transitions.

At the end, we discuss seamless Level Switching in Multi-Machine setup.

NOTE: Unreal also supports other methods, such as World Partition with Level Instancing and Seamless Travel with Transition Map. However, these methods are designed for games and are not practical for use in virtual productions.
NOTE: In some cases, using multiple Unreal projects for different scenes instead of levels can be a workable alternative. However, this approach does not support smooth transitions between scenes or allow for switching specific machines in a multi-machine setup. Loading different projects will cause significant frame drops as the computer processes the resource-intensive task of loading Unreal Engine again.

Level Switch with Open Level

To make a simple level switch, you can use the Open Level blueprint node in Unreal Engine.
The Open Level node does not support seamless transitions, meaning there will be no frames generated while the computer loads the level.
The Open Level node completely replaces the current level with a new one, so all blueprint logic must be present in each level to facilitate back-and-forth switching. Therefore, it is recommended to create an Actor Blueprint class instead of using the Level Blueprint. This Actor Blueprint can be easily dragged and dropped into each level.

Creating Open Level Blueprint

To create a Blueprint with an Open Level node, open Unreal's Content Browser, right-click, and select the Blueprint Class option:

Choose Actor as the Parent Class:

Name the created file, for example, "LevelSwitch". Then, double-click the file to open it:

Click on Open Full Blueprint Editor text if the following message appears in the new window:

Right-click in the Event Graph and add and connect the following nodes: Get Aximmetry Trigger, Get Aximmetry Text, Event BeginPlay, CustomEvent, Bind Event to Trigger, String to Name, and Open Level (by name).
The Context Sensitive search must be turned off to find the Bind Event to Trigger node.
When connecting the Get Aximmetry Text to the String to Name node, Unreal will automatically create a node to convert the data from text to string.

To copy and paste the above nodes into Unreal's Blueprint editor, click on this box: , press CTRL + A to select all text and CTRL + C to copy it, then in the Unreal blueprint press CTRL + V to paste it.

The LevelSwitch blueprint must be added to all levels. To do this, open each level one by one and drag the blueprint from the Content Drawer into the Viewport:

Make sure that the same Aximmetry camera has been added to each level:

In Aximmetry, you will see two new pins. The trigger pin (named "Switch Level" in the example blueprint) starts loading the level, and the text pin ("Switch Level Name") specifies which level to load:

NOTE: You can easily turn the trigger pin into a Control Board button by using a Control Board and a Pin Collector special compound.

Level's Path

You can specify the level's name without any path, but this will increase load time as Unreal has to search through all the files in the project.
To avoid this, right-click on the desired level's file, and select Reference Viewer...:

In the Reference Viewer, you can copy the reference of the level from here:

You can then paste this reference into the text pin ("Switch Level Name") in Aximmetry.

Static Image During Transition

Before the level switch, it is possible to switch to a static image using the If Video module in Aximmetry:

Then switch back to the loaded level when the operator sees in the preview output that the level is correctly loaded.

However, this solution only works with certain video output protocols. During the level-loading process, Aximmetry will drop frames. As a result, the protocol, hardware, or software may not display the last frame from Aximmetry; instead, they might terminate the connection.
A better alternative is to use an external switcher to play a video while the computer is loading the level.

Unreal Module's Pins in Aximmetry

If not all levels have the same Get... Aximmetry nodes in blueprints, then you must ensure that the default map (level specified in the Project Settings) contains all the Get... Aximmetry nodes that will be used in other levels, including matching their Name parameters.

This is because Aximmetry uses the first level to populate the pins on the Unreal module in the Flow Editor.
These Get... Aximmetry nodes in the first level do not have to be functional; they just need to be present in the first level.

Level Switch with Stream Level

To be able to stream levels and have a seamless transition between levels, the levels must be under the same Persistent Level. This persistent level functions as a parent level, making editing between the levels easier. The levels under the persistent level are called sublevels or stream levels; they can be switched using the Load Stream Level and Unload Stream Level blueprint nodes.

NOTE: Persistent Levels do not work with the Level Switch with Open Level method as that will unload the persistent level itself.

Persistent Level

To set up a persistent level, first create a Level:

NOTE: Any level can function as a Persistent Level. It becomes persistent not by a specific setting, but by how it is used.
NOTE: A Persistent Level can contain assets that will be used across all levels. This is how the Aximmetry camera will be utilized within the Persistent Level.

Name the created file, for example, "MyPresistentLevel". Then, open it by double clicking on it:

Open the Levels panel by going to Window > Levels:

Drag and drop any levels you want to use into the Levels panel:

You can select which level is visible in the Editor with the eye icons. This visibility setting applies only in the Unreal Editor and only while the project is not running.

Only use the Add Camera from the Aximmetry menu when the Persistent Level is selected (this is reflected by its text being blue). You can select the Persistent Level by double-clicking on it.


NOTE: This also applies to any similar action in Unreal Editor. The level highlighted by blue text in the Levels panel is the selected level, and level-specific actions of the Unreal Editor will target that. For example, when saving (CTRL + S), Unreal will only save the selected level.
NOTE: None of the sublevels should contain any Aximmetry cameras. Only the Persistent Level should contain the Aximmetry camera.

Also, don't forget to set your persistent level to the default map of your project in Edit > Project Settings:

Load and Unload Stream Level

Loading and unloading stream levels should be done within the Persistent Level's Level Blueprint.
Open the Level Blueprint for the Persistent Level:

Once the Level Blueprint is open, you can easily reference levels by dragging and dropping them from the Levels panel into the Level Blueprint:

The created Get Streaming Level node can be connected to the Load Stream Level and Unload Stream Level (by Object Reference) nodes using the Get Level node located under the Class /Level Streaming category. To locate the Get Level node, turn off the Context Sensitive search. Be aware that there are multiple nodes with similar names, so make sure to select the correct one.
Use Get Aximmetry Trigger to load and unload levels. For example, one trigger can load a level while another trigger unloads a level:

To copy and paste the above nodes into Unreal's Blueprint editor, click on this box: , press CTRL + A to select all text and CTRL + C to copy it, then in the Unreal blueprint press CTRL + V to paste it.

The above blueprint will create two trigger pins on the Unreal module in Aximmetry. These pins will allow you to load and unload the level.
You can duplicate this blueprint with a new level reference and different names for the Get Aximmetry Trigger to load or unload additional levels. However, if you have many levels to manage, we suggest using an array, as discussed later on this page.

NOTE: You can easily turn the trigger pins into Control Board buttons by using a Control Board and a Pin Collector special compound.

Seamless Transition Blueprint

To seamlessly load a level and transition into it, more complex blueprint logic is required compared to the one described above.

The picture below is an example of how to switch between two levels using two triggers (name: Load Level 1 and Load Level 2).

  1. Once a trigger initiates a level switch, the map starts to load in the background using the Load Stream Level node.
  2. When the loading is completed, a Delay node waits for an additional time specified by the Get Aximmetry Scalar (name: Load Delay). This delay is necessary because the initial seconds after the level is loaded can still be resource-intensive for the computer to display seamlessly. 
  3. After the delay, the two Set Should be Visible nodes make the previous level not visible and the next level visible.
  4. Another Delay module is used to ensure smooth operation before starting the Unload Stream Level node.
  5. Finally, the previous level is unloaded with the Unload Stream Level node.

It is not strictly necessary to use the Unload Stream Level node, because hiding the previous level with the Set Should be Visible node frees up most computing resources and makes the level invisible. Note that unloading the level will cause it to lose any progress, such as animation states.

To copy and paste the above nodes into Unreal's Blueprint editor, click on this box: , press CTRL + A to select all text and CTRL + C to copy it, then in the Unreal blueprint press CTRL + V to paste it.

NOTE: Nodes with a small clock icon in the blueprints are asynchronous, meaning that the execution following them will not happen in the same frame but after a time determined by the node:

The blueprint described above switches the rendered picture instantly from one level to another. To add a transition effect in Unreal, both levels should be visible for a certain duration instead of an instant switch.
While in a multi-machine setup, you can use an external switcher to create transition effects. For more information, refer to the section on Level Switching in Multi-Machine.

NOTE: For more details on Persistent Levels and stream level loading, refer to Unreal's documentation on Managing Multiple Levels.

Switching Between More Than Two Levels

The above solution becomes complex when switching between more than two levels. To simplify this, we can use arrays. In the example below, three levels are added to an array. Using the Get Aximmetry Integer (name: Level to Load), we can specify in Aximmetry which level to switch to. You can include any number of levels in the array, not just three.
Additionally, variables are used to keep track of which level was previously loaded and to avoid running the level-switching logic when it is already running. The Previous Level variable must have a Default Value of -1, because we start without any levels being loaded:

To copy and paste the above nodes into Unreal's Blueprint editor, click on this box: , press CTRL + A to select all text and CTRL + C to copy it, then in the Unreal blueprint press CTRL + V to paste it.

Streaming Methods

It is very important to have all the levels in the Blueprint streaming method in the above examples. Otherwise, the levels will always be loaded, and you will not be able to unload them.
However, if you plan to switch between levels solely by changing their visibility with the Set Should be Visible nodes, you can set the levels to Always Loaded. In this case, you won't need to use the Load Stream Level node on the levels after starting your Unreal project.

Level Switching in Multi-Machine

In a multi-machine setup for AR and Green production, each machine can render a different camera angle. This configuration allows you to switch the level on cameras that are currently not visible to your audience. Later, you can switch the level on the other machines once their cameras are no longer visible to the audience.

This allows for seamless transition effects between levels and, consequently, between cameras. You don't need a Stream Level for this purpose; using the Open Level node to change levels is enough. The transition effect can be managed by an external switcher device or by utilizing the [Common_Studio]:Compounds\Switcher\Video_Switcher.xcomp compound, available from Aximmetry version 2024.3.0.

NOTE: LED Wall production primarily uses a multi-machine setup to render different LED walls rather than different camera angles. However, from Aximmetry version 2024.3.0 onwards, LED Wall camera compounds allow cameras to be handled by different machines. Therefore, this method also applies to LED Wall production starting from version 2024.3.0. Keep in mind that LED Walls introduce additional complexity, as you'll need to switch the video outputs going to the LED Walls as well.

Example

Suppose CAM 1 is the camera that the audience currently sees, and it is assigned to Remote Engine #1. Then, you need to change levels on every machine except Remote Engine #1. After that, when the camera switches away from CAM 1, only then should you change the level on Remote Engine #1.

You can accomplish this using the following steps and Flow Editor logic:

  1. Identify which Remote Engine (CAM) your audience is currently viewing on your switcher.
  2. Specify this Remote Engine through the Copy Integer module in the picture below.
  3. Trigger the level switch with the Copy Trigger.
  4. Wait until your studio operators switch to a different CAM (Remote Engine).
  5. Finally, use Copy Trigger 2 to switch the level on the CAM specified in step 2.


In summary:

  • The Copy Integer node determines which remote machine the audience sees.
  • The Copy Trigger node changes the level for every remote machine except the one defined by the Copy Integer.
  • The Copy Trigger 2 changes the level only on the machine defined by the Copy Integer.

You can also add the Copy Integer and Copy Triggers as parameters and buttons to a Control Board using a Pin Collector. Alternatively, you can assign them to other control methods that your studio operators may be using.
Additionally, you could include an overlay in the preview to warn your studio operators that a level switch is in progress, advising them not to switch cameras during this time. This overlay can be triggered by the If modules in the above picture.

Article content

Loading
Close
Loading spinner icon
1/10