Level Streaming is a necessary part of any game that contain many varied levels which need to be seamlessly connected. This tutorial explains how to setup a Level Streaming solution that is entirely Blueprint based. This tutorial is also showing the transition between two levels using a hallway separated by two doors. Most of what is shown here is covered in the Content Example - Level Streaming Level.
Setting up the Level
- 1. The very first thing that you need to do is open the Levels Window, this is located in the menu under Window/Levels
- 2. Right-click in the Levels Window and select Add Level to add as many levels as needed. You might want to distribute your sublevels into subfolders that logically divides your world.
- 3. Notice which level is the Current Level in the Levels Window, as you add actors to your scene they will be added to the Current Level. Now build your world as you normally would and take care of placing actors in the right levels. If you accidentally place an actor in the wrong level you can easily reassign it by selecting the actor and right-clicking on the level in the level window and selecting Move Selected Actors to Level/
Blueprint Level Streaming
By now your level should be ready so it is time to add Level Streaming.
- 1. Since we are using a connecting hallway between the two levels we first need to add the actors representing that hallway. In this tutorial I am using two floor tiles rotated vertically that will slide down into the floor when approached. These doors were made their own blueprints and they contain an editable Level name variable. This was done to have the trigger volume animated door and level streaming in a single blueprint. Each door belongs to a different level, the door on the left is part of the silver floor tile level and the door on the right is part of the red floor tile level.
- 2. To Load a level set up a door containing a trigger volume that triggers on begin and end overlap. The volume extends in-front and behind the door. When the player enters the volume an Open Door Event is triggered. This event calls Load Stream Level passing in the Name of the level to stream in. When a player leaves the volume the Close Door Event is called and this event is only connected to the Reverse connection of the timeline. Level unloading is done outside of the sliding door.
- 3. To unload the previous level, place another trigger volume outside the door. When the player leaves the hallway he will trigger the unloading of the previous section.
That is all there is to it. For a blueprint only solution to level streaming using a set of two doors you only need four separate triggers. Two to load and open the doors and to outside to unload the other level.