Level made to saving isn't working

this is all connected to a play button in the main menu hud at this point it does nothing I don’t know why also the second screenshot is connected to a begin play on the third person character

A few things I can see might be issues.

  1. Is there a ThirdPersonCharacter in the level at the time you are selecting the “play button”? If not that first cast will always fail. So if this is simply a “main menu” widget in an empty level you don’t need that cast. Although the way you have it set-up is a little odd so in your case you would actually need to place a character in the level somewhere even if it isn’t visible just to be able to access the data variable of the level from the character BP. And if that is the case the issue with that is, the character isn’t going to be able to “save” anything in that variable between levels, it is instanced each time the level opens so would only have default values.

  2. You are loading a save game object then saving the output as a variable BEFORE casting it to a specific type so this :save game object" will not be your specific type and therefore that variable is useless when trying to access the variables of your specific save game object (levelsavingsavegame). You got around this by then immediately casting that variable to your “levelsavingsavegame” but the entire process is convoluted and redundant. You should do the cast immediately after the load and then save the output of the cast node instead.

  3. You have 2 different variables for the “slot” FYI, in the third person character BP you call it “Save Game SLOTName” but when you pull it out to use in the menu widget you are getting “Save Game FILE Name” are you aware of this? I am not sure why you would have 2 different variables for that.

Anyway, off the bat I would say any one of those or a combination of those issues is why nothing works ha

oh sorry for confusing you with the third reason I had it as save game file name then changed the name of the variable to save game slot name in between the screenshots whoops

did i fix it? (for the second reason)

Yea, you fixed part 2, but I really think your issue mainly lies in part 1 and how you have this whole thing set-up to begin with. It is kind of an odd set-up.

This tutorial I made may help if you have never done it before.

If you already feel you know how it works then I suggest you fix how you are implementing it by not having the ThirdPersonCharacter be responsible for telling you what save game slot you are in, that is just a recipe for disaster. Save and Load game is usually best handled by a global BP like game instance or the Level BP

That could work, but you will have to re-create all that code in each level. Which is why I would recommend creating a save game function in the game instance and just feed into that function the level that you are on. You can call the function from the level BP on overlap of the trigger volume. The link I posted shows you the basic setup if you need more help figuring that part out. Should be able to modify it to your purposes.

…? haha what does that mean?

yea im realizing this now

yea I tried something dumb to see if I could make this work because I had a different character just for the main menu then I was casting to the third person character with the object as the player character soo that just was dumb of me then I decided to try this just to see if it would work

that just came up with errors of invalid urls because even with that it would still set the level to the main menu soo how would i go about this i feel like i did this wrong from the beginning would it be better if once the player triggers the begin overlap event to go to the next level would i set the made to level there? in the level blueprint.

…ok

have never used game instances before D:

ooo im looking into it by that i mean im watching a basic tutorial on it

seems VERY helpful if i knew about this i wouldn’t have wasted my time making that borked saving system

I think you should look into that then! It persists between levels so it is a great place to dump data you want to have access to in other levels and it is easily accessible from any blueprint by casting to “YourGameInstance” and using a “get game instance” node as the object input pin. So you can easily communicate with it from your level BP and tell it what level you’re on and then as I said, create a nifty function to save from anywhere!

Yea dean is great. Well hope this gets you squared away then!

You are trying to open a level called “1”…i am sure that is not the actual name of the level in the content browser. You need the exact name of the level to put into the Open Level Node

ok i tried as you can see in the following screenshot and im still getting this error.

][4]

but it is called 1 (my naming scheme is verrrrrry complex)

Have you made any progress on this? If not let me know, I may just re-write this entire code for you haha I feel if you haven’t fixed it by now better to start from scratch and do it properly in a game instance and to be honest it would probably be easier for me to make you a functioning one from scratch than to try and troubleshoot yours :slight_smile:

yea i think i fixed it via using the game instance but im having a problem where the main menu keeps bringing me back to level 1 instead of the level i made it to