Return to same spot from level

I’m sure this has come up before so I’ve searched the forum but no joy, sooooo: Fairly new to Unreal & blueprints. I’ve created a second level my player “goes to” after unlocking a door using the event OpenLevel from the first level. This is kinda a sub-level of the first level. Returning works fine using OpenLevel again but it takes to player to the initial player start position on the first level - as you would expect. I want the player to return to the point that he left the first level from so that he/she can complete that level before progressing further in the game.

I suspect I need a global variable to tell the first level which player start point to use when it loads but that’s about the extent of my knowledge so please keep any help simple!!

Thanks in advance

Ray

You can place a trigger in front of the door. If the Player goes through the trigger, takes this Location and set it up in a variable in your gameinstance. Then if you came back, check over a bool (in gameinstance too) if the game was started or it is running and set your Players Location to the saved Location.

The Gameinstance is not being destroyed if you load a new Level. All variables in it will live forever until you quit the whole game.

I agree with Beregron. The Game Instance isn’t destroyed when you’re opening different levels so it’s your best bet for saving information across level transitions. You can create a new blueprint for one and set it as the default Game instance to use in the project settings. Create a new vector variable in your Game instance blueprint, and when you need to save your pawn’s location, use the node “get game instance”. Cast from that to your custom Game Instance Blueprint and you’ll be able to get and set the vector that you created in there.

I think I understand what you’re saying but I don’t know how to set the location for the player to reappear at. Remember I’m practically an Unreal virgin :slight_smile:

I’ve sorted this by starting by asking the right question. “How do I place the player at a specific spot when I start a level”. I’ve created a persistent variable in my game instance blueprint and simply check the value with the BeginPlay event. Based on the condition of my variable I just teleport the player seamlessly to the desired position. No need to move the player start at all.

Thanks for your help anyway!