Hey guys,
I’m working with a mechanic that requires all instances of a certain actor blueprint to be reset once the player leaves the room. The current setup I have is to reset the level once the player touches a checkpoint. I’ve tried using ResetLevel, but it deletes the player character. I’ve also tried OpenLevel but that puts the player back at the start.
Is there a way to reset a level but keep the player at the checkpoint location, or is there a better way to go about this that I’m missing?
One approach is to use a custom GameInstance. The GameInstance is persisted between level loading so you can use that to store a reference to the checkpoint you want to spawn at.
The next part is to implement the necessary logic so that when your level loads it will fetch and use that reference to spawn the character. Don’t forget to set a default checkpoint for when the level is loaded for the first time.
Another approach would be to use the SaveGame object to save the necessary spawn location to file and then load it up when your map starts. This would persist your current checkpoint beyond a single play session.
You could also use a streaming level and make sure your checkpoint floor is part of your persistent level you then unload the streaming level and reload it.
You have your main persistent map which you load the streaming level into. then when you want to reset it unload and reload the streaming level.
this means the level around the player would disappear and reappear. so in your persistent level where you trigger the reset you’ll have to have something for the player to stand on while this occurs or they will fall to there doom.
this will keep your player but reset the level in a seance.