Level streaming / open level issues

Hey so for the past week I’ve been trying to get level streaming working with my game instead of using OpenLevel because when I use OpenLevel, there is a long freeze which temporarily freezes my game which I can’t have.

So I tried using level streaming but it’s been taking so long to get work and it still isn’t working. :frowning:

Basically, when I want to I Ioad the new level and then unload the old level.

But when all the new classes of the new level are initialised, pretty much all of their references and pointers to other classes are null. All of these class references, eg. player where all not null when I used OpenLevel + everything worked completely fine, it is an issue with level streaming.

I’m guessing it’s too early before everything has been initialised or something but I thought level streaming would work properly and make it so when I load a new level, all my class pointers are not null, and have things execute + spawn in the right order so they are not null, as it is a built in feature…

Please! Can someone help me I have no idea what to do I would have really liked to just use OpenLevel as level streaming is so much more complicated but it just freezes and level streaming doesn’t work either.

Help with any option please, I just want a working game! :((

I’m sure someone will come up with a real solution (which I would love to see so I can do it correctly too). What I had to do was pick my most important class, my player character in my case, and have it set a variable in GameInstance that said all the other classes could proceed in their BeginPlay. All the other classes have a split BeginPlay which does internal (to the class) initialization, but then executes a timed wait loop before continuing with any initialization where there are dependencies between classes.

In other words, in my case, if my Character class completed it’s BeginPlay, I knew it was safe to proceed. It’s a kludge but I was unable to find docs to explain how things were supposed to work, and this has been a workaround for now.

1 Like

Thank you so much for this workaround option, I will try it out now and yeah I hope someone comes up with a real solution someday!

Hey so for the past week I’ve been trying to get level streaming working with my game instead of using OpenLevel because when I use OpenLevel, there is a long freeze which temporarily freezes my game which I can’t have.

Are you trying to make a map without any loading screens at all, or are you trying to move between seperate maps?

1 Like

I don’t mind making loading screens (prefer without obviously) but when I was trying with OpenLevel, I was attempting to move between separate maps and then when I tried with level streaming, I had one persistent map with all my levels in.

I did try making a loading screen with OpenLevel, but the game still freezes so obviously and nothing moved on my loading screen as it froze, so I gave up with that.

When loading a new map, the map has to be loaded into memory. UE handles this by first loading the new map, then destroying the old map, as there must always be a map open in UE. This process takes time so that’s why you’re experiencing freezing.

Loading between two larger maps means that you will have both large maps in memory during loading.

I suggest you create a simple loading screen, just an empty map with a widget that says “Loading” or something, and use that. You can select your loading screen map in Project Settings. Search for “Transition Map” or something like that, and whenever you load between your maps, your game will load then small transition map, destroy the old larger map, then load the new larger map and then destroy the transition map. You shouldn’t experience any freezing this way, unless you consider a loading screen the same as freezing.

If you want to stream in your levels, there are probably ways to do this too. I’m not familiar with this process, but in UE you can’t have more than 1 map open at a time, so you’d have to perform some sort behind the scenes magic to make it work I imagine.

1 Like

Okay, thank you for your help! :slight_smile: