Load Game from Slot is reading wrong file?

Hey everyone!

Currently in 4.8.3 But I have tested it in 4.10 preview 2 as well.

Everything works perfectly in PIE and after packaging the game for Win64 when saving the game using Save Game to Slot it saves in the correct place. C://Users/User_Name/AppData/Local/App_Name. But when using the Load Game from Slot node to retrieve those variables it reads the old .sav files that are in the editor directory on my D: drive. Has anyone else experienced this problem?

tl;dr: Load Game from Slot isn’t loading .savs from the right place.

Sorry to bump. This is still giving me trouble. Recently discovered that when I Load Game from Slot in the level blueprint it loads the right one. But when it is loaded from an actor blueprint it loads the editor .sav.

The build configuration changes where saves are saved, shipping or development, which are using, and does changing affect anything?
Also, can you post the bluprint where you are saving?

As Mosel3y said, only Shipping mode writes/reads file from AppData folder.

I am using a Shipping build in this situation. I was thinking over the weekend maybe it came up since I have been working on this project since 4.2 and it is now on 4.8. Perhaps older shipping versions used the same folder structure as the dev builds and something got left behind along the way?

What happens if you remove the old saves, it just doesn’t load anything?

Yes sir, that is exactly what happens. Will post a blueprint screenshot shortly. Building atm.

Alright, here we go. Since it is kind of hard to see, the target of Save Game to Slot is being sent from the Set SavedInformationActor node. All of these are in one actor.




The links are included for larger versions.

Doesn’t look like anything too strange there… but DoesSaveGameExist must be looking in the wrong place too?

It is pretty weird. I guess it could have something to do with changing engine versions as you said, there is some comments in GameplayStatics on workaround for “crash loading a pre-4.8 version of your savegame file”.
Is it possible for you to migrate this blueprint to a new 4.8 projects and see if it works right then?

Going give that a shot! Will update with results.

After migrating the SavedInformation Actor and all the other blueprints required for the system to work correctly to a new 4.8.3 project: Shipping build is still writing to C://*******/App_Name and reading from D://********/AppName. I can upload the recreation if you guys would like.

That is very strange… sure, I’d like to take a look if you upload it

The options Plaque and Child Life Playroom must be selected in the GUI for this reproduction.

Select the plaque you want and type in what you want it to say in the boxes and then click update to display it in the game. when you click render it should be the same information on the same plaque in the next level (lettering positions may be off in this reproduction also.)

Just had a chance to try this. For me, Shipping and Development builds save to the right locations as expected, and load does not work at all for either. (I’m judging this from the fact my entered text is not used by the the next level). When I play in editor, it works fine save/load. There’s definitely something strange happening here, I’ll look at it properly again later.

After you try it in editor and then create a shipping build does it load the editor information onto the plaques?

Yes it did actually.

There is some strangeness in the way things are being done, or maybe I’m not understanding what you are doing correctly, such as SavedPlaque is not created unless an option is changed under “2. Choose Plaque”. If I leave Main Campus as the selection and make no further change there, the save isn’t created. This is because of the way you are handling the event dispatchers (only called if something is changed).

Also, you are duplicating logic in the construction script and event begin play. I think using saves in the construction script like that isn’t going to work well, it is relying on something that may not exist. There isn’t any checks before loading saves, and the old meshes were staying for me. PlaqueBlueprint also relies on variables from an event dispatcher on begin play, that won’t have been called. It won’t matter for some which have default values, but it’s using the enum directly from the event.

When the second map opens, there is no main menu, and the so the cast fails and nothing else happens in the event graph.

I suppose you are doing it this way with the construction script and event graph so that when you open the map it uses the construction script, and otherwise uses the menu but I think you should spawn it instead, and have your values set to be exposed on spawn. Probably most of this is intentional, and doesn’t answer why it is using different save locations, but I think it could be complicating things. I didn’t get a chance to look into in detail, I will get back to you again if I find anything more relevant.

edit: also actually in the SaveInformation blueprint, you check if the save exists and laod it, but never actually do anything with it, you jsut save over it. I don’t think you need to load it , you can just overwrite it. Also, all of those set the same SavedInformationActor, I changed it to promote the casted save to a variable and use that (each one using one of the 3 save types), it makes mroe sense to me, but it didn’t fix the issue.

I wonder if when the shipping build can’t find a save, is it juts using the meshes that were set when the game was built? As in, it isn’t actually loading a save from the wrong place, it’s just not loading at all? When I deleted all saves it kept using the last text I had in the editor when I’d built it anyway which was just “!!!” or something.

Thanks for the insights! Seriously, You’re the first person who has had any ideas on what could be causing this.

Alright, so you think the .savs should be created on begin play if they don’t already exist, Then saved over when changed?

I like your idea of getting rid of the construction script and instead building the assets on begin play. Originally the event script was only used in the first level so the user can see a preview of what the construction script will be building in the following levels.

The main menu is only supposed to exist on the first map.

On begin play in the TextSwap BPs it should be destroying all the meshes that were previously created and getting the new meshes from the SavedText.sav Really strange that it is keeping the meshes without a sav to read from. On my end if no SavedText I get no meshes.

Hey HaxO, I think I have fixed it, it now uses the correct save locations. Hopefully it will work for you too.

I’ll upload my changes so you can see, and just summarize some of it here. It does break the preview idea though, you’ll probably need to look into another way of doing it.

I believe the edit to my post above was what was happening. The constructions scripts were causing problems, and loading saves that didn’t exist were causing problems. Event dispatchers were causing problems, notable with the PlagueType enum, which was usin the value from the event, and not the local enum.

-Removed construction script
-Made all plagues invisible by default
-Check if menu is found, if not check if save exists, if it does load it and set the values. If the menu does exist, continue as normal. Both paths set PlagueTypeLocal, and go to the switch on enum. This means the actor works in the first level with the menu, and when you load, without a construction script.

-Removed check for save file
-Always creates new save object and overwrites (no reason to load)
-Each promote the casted save type to a variable and use that

TextSwap Actors: (same changes to all 3)
-Removed construction script
-Check if menu exists similar to above
-Check if saves exist
-Explicitly set values
-Fixed how StoreAllMeshes was being destroyed

Let me know if you download it and it’s working for you too

Awesome work! I just tried your example and it worked perfectly. Going to start getting the solution implemented. Will update later on!

The preview was working as well. It just wasn’t getting the translations right. I will look into it.

Woot, Everything is in there and working as expected. Thanks for the help!

To fix the preview I set the UpdateLines dispatcher that triggers when the update button is clicked to also be called when the plaque is changed.