how to load game state from menu,..(difficulties with player not existing yet,so no values to tweak)

i have a main menu (not escape menu while plaing), with load button, loading obviously doesnt work because
there is no player to set values to after i press it.
so i’m confused as what approch to take now :- ) thanks
input appreciated.

You select a difficulty, and once the player is loaded/created, check what difficulty was picked and adjust the characters values right before the scene starts. Or just at a good point before the player sees any gui.

well, it depends how you save your data, but in general, you either create the necessary components before load or after load, when you process the data create whatever you need as you go

well i have a json with everything i need to save, _ stats,skills,spells,items,chests etc,…
so you say first load saved scene, put in a default character, and then polish values accordingly
right?

Since you have a list of settings you read from your JSON, I would load it up and I would load/create things as needed, so you don’t load anything you do not need it.

not following you sorry,… i load only what i need.
let me rephrase the question : I click on load(no player no stats in-game yet, although previous progress is saved), what should happen first?

  • read your JSON and convert it some sort of things to do
  • go through your todo list
  • if you find something isn’t created/loaded yet, then create/load and then apply saved settings
  • do it until every setting in your JSON applied to something

I guess you’re writing things like which scene you’re in, where is the player, what he/she has, etc.
So when the JSON says, it’s the scene4, then load scene4. When the JSON says, the player should be at Vector3(100, 200, 300), then load/create the player and put it in place… and so on.

i am really sorry if i am the one not understanding correctly.
I have working save/load that works only if player is already in game.
the main problem is i press load button in main menu(not in-game escape menu,mind you), and it has logic for loading all at once, (scene,then stats,then stuff)
but when i am in the main menu before i start to play,. the load tries to load stats on player who don’t exist yet.
what is the way to overcome this?
i tried to load the scene first,but then all from main menu gets destroyd and how should i keep loading then? hope it makes sense, if not i give up :- )

You should look into a persistent scene and using additive loading. The general idea is you have scene 0 loaded at all times with only the most basic managers/components your game needs at all times loaded in memory.

After that you can load or unload scenes as needed using additive loading. Then, when a scenes finished being streamed in you can read the save data for the scene and apply it.

i heard of additive loading, not solving my problem though :- )
i use dont destroy on load.

You just have to load up your data and not apply it till needed. There are a ton of different ways to do it.

But for example for me, if I was loading a difficulty setting, then I would load the scene and make adjustments to the characters stats at the start of the scene before the player gets to see any of the stats. For example, if the player chooses easy on a main menu, I would record that they chose easy. Then load the scene and maybe give the players character more health.

If you are loading saved data, you’ll probably want to look at a loading scene to prepare things (if you have a lot of data) or just load at apply at the start of the level.