Unable to replicate actor spawning from SaveGame

Hi all,

As the title says I am unable to spawn an actor from a save game. I have this exact process working for the primary weapon and after copying, creating/replacing the necessary variables I just cannot get it to spawn.

Getting data:

Saving data

Loading Gun (Begin Play)

Nothing prints (yellow box) but the BP definitely saves.

What am I doing wrong? Noob developer.

Thanks!

Does it work when you check for an existing SaveGame before you create a new one? See this (Press 1 for CreateSaveGame, Press 2 for LoadSaveGame):
SaveGame.zip (854.1 KB)

The SaveGame functions are in the GameInstance.

1 Like

Hi


This is the only check that I can see within the BP you provided. Not sure why I would need a check on a Cast fail when I know that the savegame is created. I can see the Secondary Weapon Savefile in the desktop content browser. It is as if Unreal just wont load it but checks that it is viable and everything.

With my own check the Cast Failed DOES NOT FIRE.

Ok, did you try to print the class when saving(screenshot SavingData)?

To check if it is set and not empty?

Thanks for the help. I did and it came back empty.

(I believe I showed this in the third photo so you can see where in the squence. The yellow highlight)

Does that mean that the save file is being created but nothing s stored in it? If so, how can I check is something is within the savefile without actually calling it?

Yes the save file gets created correctly with an empty variable. I don’t know if you can check if the savegame has any values.

When do you use this savegame? Is there always a primary and a secondary waepon set for the player? Or could it be possible for the player to only have one of the two? If the player has always 2 weapons, then you should check if both values get set inside the player correctly. If it is possible to only have one weapon, then you would need an empty value and check => secondary empty? then don’t spawn one (just an example).

Check the first three screenshots where I lay out the process.

Essentially player spawns the weapon after selecting UMG element. This happens just fine. Then saves the weapon to be used later.

Again I have copied this exact process for spawning the primary which works no issues

I saw the screenshots, yes.
You can upload the project or a minimal project of what you have and I debug it for you.

Not sure that’s possible as some of the material is from the Marketplace but I can look into taking it apart. In the meantime how would you debug it? I am going to look into validating the savegame within the sequence.

With the onboard debug tools and by hand. Shouldn’t take long.

He made a good offer. So what he needs from you is easy to do:

  1. Make copies (not move) of your main assets, and copy them to a new folder called Public.
  2. Then right click Public folder, and migrate it to a new (empty project - you might need to make one before you do this step).
  3. Then open Empty project > change paid textures to Default textures. And change anything else.
  4. Put all your actors in 1 folder if not that many (or just the main ones in your main folder). Makes it easier for someone else to click and learn what is what. You can put textures ect in their own folder.
  5. Then in Windows, go to where this project is saved, and zip up all those files. Then upload it somewhere to link for him. Or dm him.

Found the issue. I hadnt understood that Savegame files cane be createad without any data and therefre though that the Savegame function was firing when it wasnt. Turns out I had a bad cast because I set the Game Instance as a variable which became invalid due to a branch.

Thank you for your time and patience !

Good luck if you are using Epics Savegame thingy. It was buggy and incomplete for me. Theres a youtuber who made a Save game manager (plugin) that lets you easily check mark which Actors and variables for the Save game Man to save for you.
But it was for an older version I dont have. And I asked, but no one recompiled it for UE4.27 (open it and save it).

Epic’s way is too tedious, required me to make copies of every variable I wanted saved > to put in the Save Game asset vessel.