Opening Levels with Doors

Hello, I’m trying to find a tutorial on how to switch levels in an interior setting.

The way I have it set up is each room is its own level and opening the door opens the level. But some rooms have multiple doors. The trouble is that regardless of which door I enter I will spawn at the same point.

So I’m trying to find a way to link doors together so that when I re-enter an area, it won’t spawn me at the beginning of the level but rather near the door I entered from. Any help is appreciated!

-Cheers

You could use level streaming.

https://youtu.be/GkDg9GPpzXE

Store the door info in the game instance before opening the level. When the level opens, it looks in the game instance to see which door was used and move the player to that door.

Thank you for the responses, I definitely appreciate it! So I looked into both level streaming and game instances. Level streaming wasn’t the way I wanted to handle level transitioning for this project (although it was interesting to investigate).

As for game instances, I managed to get game instances to work for objects. Now I can have “coins” (Which could easily turn into health packs, ammo, etc) move with me from level to level and keep track of how many I have on my HUD. So that’s at least one problem solved!

But I can’t seem to get it to save my door info. I tried to get it to pull the info for the level change BP and I tried to get it to reference the door bp itself, but I must be doing something wrong. It always spawns me at the player start node. I guess I would need to see an example BP or something, it’s got me pretty stumped.

When the player opens a door, the door knows where the player should be after the level knows. How it does that is up to you, but if it’s a BP, you could have something in the BP which marks where the player should spawn when the next level loads.

So, in the door BP you can say:

Now that coordinate is in the game instance, so when the level loads, you can say:

Boom, player’s in the right place, next to the door they just opened.

EDIT: It can also be that the door doesn’t know where to put the player. In that case, the new level must know where each door is connected and have references to them, they could be numbered, or whatever. Then, the door just has to say WHICH spawn point to put the player at.

The idea is that somehow the door puts something in the game instance, which the newly loaded level can use to figure out where to put the player.