Loading multiple level instances

Hello all,

I’m trying to load via blueprint multiple level instances I added to my scene.
I tried with for each loops or event dispatchers but no matter what I tried, only the first level is loaded and subsequent levels are not.

For instance I tried only loading the next level after the previous one has finished loading, like this :

The print string linked to the branch never triggers.
It looks like the second level is requested to load while the first one has not finished loading but I’m not too sure.

What am I missing ?

1 Like

what happens if instead of binding you just hook up to this pin?

Easiest way is to make your own special level streaming Foreach loop.

I made a copy of the Foreach macro, and converted it to level streaming :rofl: ( note: don’t change the default macro, copy the code into your own macro library and use that )

So I can say

I have 3 levels, each with a shape in, it works

levs

Admittedly, not an exciting test, but it works…

You can also put a delay in, if you want

levs2

1 Like

Hello to both of you, thank you for your answers.

I religiously copied your code and double checked every node including the level names but I still have only the first level loading in.

This is plugged to the begin play of my blueprint.

In engine :

In game :

I plugged in a bunch of print strings in the macro and it seems I’m looping indefinitely inside of it and I’m not too sure why.

1 Like

Can you show the code?

I moved the print strings out of the way for clarity.

It looks like I’m only incrementing the loop counter once for some reason.

1 Like

I think the second assign is resetting the loop variable. The standard macro uses to variables, because it has to pass one out during the loop, but I noticed on closer inspection we only need one. Here’s the update

It works perfectly, thank you so much !

Just a quick additional question. Why the delay ?
It seems to work without.

1 Like

Yes, it will work without, because we’re using the Completed pin. I just put it in to make the demo a bit more interesting! :rofl:

1 Like