How to use game instance to transfer a spawned player between levels
I followed this tutorial by Unreal Engine: https://www.youtube.com/watch?v=ZOc9fV6Sap4&t=196s
So I have a 4 player couch co op game where you can drop in and drop out, on loading the next level, everyone has to respawn (drop in) again. How do i carry over if they are already playing or not. I know its has to do with storing a game instance, but not sure how to get the variable of players spawned.
Many thanks in advance.
asked Apr 19 '18 at 05:08 PM in Blueprint Scripting
Gameinstance is a class that survives for the entire instance of the game.
Now, lets say you have a variable "IsAlive" stored in Game instance. Create a PlayerInfo Map (Dictionary) of PlayerBP and PlayerData struct.
The playerdata blueprint would contain data like IsAlive, Score, Coins etc.
When you go to new level, iterate the through the PlayerInfo Map and spawn the player based on the data (as the data would contain if the player is alive or not)
Follow this question
Once you sign in you will be able to subscribe for any updates here