I have Main Menu level and Game Level. In main menu I have [New Game] and [Load Game] buttons.
Question: how to open level with condition for loading/preserving original (default or from editor) player’s state?
After Open Level I can’t execute any node. I saw ‘Options’ input in Open Level node. Is it only way to pass data (also, I didn’t find way to get access to it)? Is storing data in game instance fine or is it just temporal solution?
Hello! Can you provide a screenshot of BP scripting and layout please?
It’s always recommended to give detailed information.
I wish I can help!
It’s huge. I need just pass value for BeginPlay event of level to decide should Loadgame function be called or not.
Ok, I made some sort of call stack in GameInstance for that purpose.
If you’re doing networked multiplayer keep this in mind: GameInstance vars will persist for the server, but GameInstance is not replicated to clients.
So what I often do in your situation (if networking) is I create the same variables in GameInstances as I do in GameState, for the ones that need to both carry over between level changes AND need to replicate to clients. then when GameState BeginPlay, if Is Server, I copy whatever is in the GameInstance over to the GameState.
the GameInstance does not persist between runs of the game, though, only between level opens.
so to persist data between game runs you must store as a config variable, use unreal Save object(s), or come up with another solution.
Yeah, thnx. That’s bad that there is no way to pass parameters in Open Level. Already using GameInstance.
You can open level passing parameters using Console Command node but I dont know if it works in Shipping builds so test that and make sure.