Level Streaming
- Level streaming allows you to load and unload levels.
- This is different from the methods we looked at before.
- Multiple levels can be present at the same time.
- There is a Persistent Level which is always loaded.
- This is loaded /unloaded as the main level.
- You put everything in this level you need
- Suggestion, ground and walls.
- This way your AI will not fall through the world when the player leaves the area they are running around int.
- There are multiple other levels.
- You will be using the level menu.
Windows
Select Levels
This brings up the level window
If you wish, you can change a level so it is always loaded.
- This is good for having multiple people working on a "level" at the same time.
When adding components, they will be added to the level selected.
- The first thing I want to do is make things appear and disappear as time goes by.
- You know, like in the house during the day or night.
- I have created three levels,
- Either through the normal way
-
- Then add it to the streaming level
-
- Or through the drop down menu
- Double click on a level to add an item to it.
Task 1, loading a map or two.
- This is accomplished via LoadStreamLevelByName
- Or unloaded with UnloadStreamLevelByName
- I created two new levels
- CubeMap
- Be careful, the name spelling must match exactly
- I added a cube to this.
- SphereMap
- I added a sphere to this.
- I made it so the cube was loaded on default.
- In the blueprint level
-
- I added switch (collision box and a plane so I could see it).
- I added this to the scene.
- With the box selected, I went into the level blueprint and added
an on begin overlap event.
- Notice you can now open sub-level blueprints as well.
-
- I added a level variable to indicate if the cube was loaded or not.
- I set this to be true (the cube is loaded)
- If it was,
- I unloaded the cube and loaded the sphere.
-
Cycling through the items.
- I added a three more maps.
- I put text in each.
- I added two variables
- An integer time, which is really the level I want added.
- LevelNames, an array of names.
- I added the three level names to this.
-
- I added a timer, to the new custom event NewTime
- This loops every five seconds.
-
- I also loaded the level pointed to by time.
-
- The NewTime event just loads and unloads the appropriate level
- With an periodic index.
-
Loading levels automatically
- Levels can also be loaded with a level streaming volume
- Add the level.
- In the Persistent Level add at least one Level Streaming Volume
- Probably one for entrance
- And one for maintains at least
- Select the level and click on Summons level details
-
- Add the Level streaming volumes to the Streaming Volumes list.
-