Download

Create level instance in current level through code

Hello all! I’m currently trying to transition from an older game engine that I was super familiar with, to Unreal to enjoy the benefits of an up to date engine, and my current project consists of a small level, a square room with 4 doors ( one on each wall). when the game is loaded, the code will create random rooms connected to those doors. These rooms are pre existing levels, that can just be loaded in through my algorithm, and are fully interactive. At no point is a level (or room) unloaded or closed.

So I’m wondering with Unreal, is this a possibility? I’ve been able to create all the individual rooms as separate levels, but looking at tutorials, I can only find loading a new level and closing the current one. I saw something about level streaming, but the video I saw about it showed no collision with it which won’t work in my case.

You need to read about level streaming

The levels you want to stream should be sub-levels of your main ( persistent level ).

Okay! Well thank you for the information! This brings me to a second question. If level streaming is a new feature, how was this done before? Or was it possible in this engine?

Level streaming has been in the engine for a long time. It has also, in fact, been around since day 1 in video gaming. I saw an interview with the guy who wrote Crash Bandicoot the other day, they basically invented level streaming on PS1.

EDIT: Depending on the complexity of rooms, it can also be done with blueprints ( a BP for each room ). That way, you can dynamically load/unload as you’re going. No need for streaming.

That’s how I did the maze you can see in this trailer:

Android Packaging Issue Someone please help for my problem also

I want to try going about it the blueprint way, but I’m confused. I thought a blueprint was like an asset that can be placed multiple times, and if you change the blueprint for the asset, it would change all the instances of it. However, when I try to create a blueprint of the individual sub-levels, I get the flowchart because blueprint is the visual coding aspect? I am genuinely confused. Could you clarify how you took the blueprint approach for load/unloading?

He tells you in the vid :slight_smile:

You have a persistent level, and add all the levels you want to stream as sub levels.

Then, in the persistent level ( level BP if you like ), you can load and unload the sublevels. Even though the vid refers to menus ( I seem to recall ), they are still levels ( maps ).