Hello! This is my first post so sorry if i do something wrong.
I’m saving some variables using SaveGameToSlot. The problem is that there’s a map which is saved and loaded flawlessly (ObjetosPorZona), but the other one (EnemigosPorZona) always loads its default values. I checked if its not saved correctly but it is, and i save and load the 2 maps the same way,so i dont understand where the problem is, can someone help me out? I’m working on UE4.22.3.
As you can see, i use a struct inside the SaveGame to set all the data. In ObjetosYEnemigosPorZona I get the data to save in the 2 highlighted maps in the next picture.
I think i’m doing it the same way you are, but my functions are longer.
So it’d be correct if i use my saving game function more than once? I’ll try that as soon as i can, thanks for your answer!
About the 2 main problems, i don’t think I do that cause:
I only create a Save Game Object once
I don’t think i’m not using the variable inconsistently even tho i’m not sure how to check that
I made sure the SaveGameObject child variable is not inconsistent so i deleted it and used it exaclty the same way you did (getting it directly from the cast node), but the problem persists.
Could you also tell me the correct way to partially save a game? I’m not sure if I’m doing it well.
I tried it only saving the maps (which now are map filled with integers cause i had to get and older version of my project).
Maybe the structure where i save all the data is the problem here and i should get rid of it? I’ve had some headaches because of them in the past so maybe…?
I have 2 maps, both filled with integer keys and integer values (previously was byte keys and byte values). The blue things are other 3 structures which, expanded, are like this picture I posted before:
https://forums.unrealengine.com/core/image/gif;base64
It’s not a loop of structures cause they all are different type of structures. let me show you better, these 3 are the same, but splitted:
Still not working (i omitted the previous steps so you can see it better)
https://forums.unrealengine.com/core/image/gif;base64
I also noticed that both of the maps are not loading correctly now after being converted to integer maps.
This looks fine. As long as you don’t have code elsewhere that’s wiping the save game, when you read it back in, the struct data should have been saved.
The struct can be as complicated as you like, but what I’m saying is, get it working for a really simple example first ( in a new project maybe ), then come back and fix this.
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_216801_1617016439559_343”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_216802_1617016451910_203”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_216803_1617016461654_939”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_216804_1617016477073_200”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64
The data is saved and loaded correctly (all the values go from the default ones to mostly -20).
I did it pretty similar with my old project and seems to be working, but why? what am i doing wrong when i was saving and loading like i did originally? and what do i do now?
I still have to make it work with all the additional steps… But yeah at least it’s something. I guess I’ll be adding them progressively so i can see where it’s failing. Thanks for helping a noob out, I might add more posts in case i can’t find the problem.
Okay, I think its finally working. I realized there was something wrong with the way the maps where being loaded (still don’t know what the exact problem is) and i replaced the maps with arrays filled with a new Structure which contains 2 integers: ID and InitalQuantity. The saving and loading is practically the same, but using structures, here’s a picture on how I’m saving it and I hope this helps people with the same problem: