I made a move to level streaming from the good old hard load mechanism a couple of days ago so admittedly I’m still learning the ropes here, please bear with me.
Things have been straightforward enough so far as long as everything’s confined to one persistent level: stream new sub-level, unload the old one, done.
However, I also need the player to move between different persistent levels as well in certain situations, and there is a caveat.
What I have tried so far is making an object that passes over the names of the persistent level and the sub-level we want to load to the game instance BP (which stays around when we get to opening a new level part), then in the game instance BP I open the persistent level and load the streaming level by their respective names. Now the former is working alright (nothing fancy there), however the streaming level part seems to do nothing. Game instance is actually calling an event in the game mode to stream the level which might be the reason it isn’t working - like the game mode isn’t there yet and the stream event is called immediately after the open persistent level one - though I was assuming that the game mode should be the first thing to show up. Not seeing any errors either, it’s like the stream event call is just ignored.
In the limited amount of time I had to play with this functionality today, I have so far found a workaround by making the new persistent level load the streaming level itself on begin play, which is fine as it is but doesn’t quite give me the flexibility I want.
So what is the correct way to approach this? I don’t have the access to the project right now or I would be testing things myself as we speak, but at least I can do some information gathering.
For example, what would happen if I just tried to stream the new sub-level without opening the persistent level first?
Here’s an example of what I am trying to achieve: let’s say I have two in-game locations A and B (the two persistent levels I switch between). Both of these have 4 sub-levels each, signifying time slots - morning, noon, evening, night. Each sub-level contains the light settings and the actors (including NPCs, enemy spawns etc.) relevant for each location in the given time slot. Stuff that stays unchanged between the slots (e.g. level geometry) is kept in the persistent levels themselves.
Now, let’s also say I want the game to “advance time” by one slot when the player travels between these locations. So if the player left A in the morning, location B should load with “noon” settings, and so on. This is why I kind of need the flexibility of being able to load a specific sub-level as mentioned above.
Any suggestions would be welcome. Thanks in advance!
Also, just in case that matters, everything is single player only.