save and load array variable in savegame-- need help-- unreal engine4

urgent help – .I have some different types of balls that are open or clickable when specific level cleared. I have a array variable in save state that store Boolean value for balls to open or not with another integer variable that is increment after set Boolean value for array true, and i get the array value in widget with binding. the problem is that the length of the array always print 0. How to access the array variable of save game state.

You still have the same problem with the save game :slight_smile:

If you create a save game every time you want to use it, it will be empty - ie - nothing in it.

That’s why it’s not working.

i need to save last level name, total coins, all prize data etc. Is i have to crate different different slot and create all in begin play or can i use only one save slot for store int, array, string variable data. Or i have to use begin play of my player or game mode or game instance. the one problem is also that if i install game in phone and run it. if i leave the game then all data lost and game begin from level1 and coin set to default. and all open balls prize lost.

my functions are in gameinstance how to use beginplay there.

BeginPlay in game instance is called EventInit.

You only need one save game. You just need to make sure that you always load it before updating and saving it.

Only create it once.

It is working if i continue play game. The image of button set / clickable after level complete but if i quit the game and re-open it then the button image again not visible. All button image set using binding.

Ok, show me the code for making the button clickable and how you save it :slight_smile:

So, you’ve loading, and updated the object. You need to save it as well…

Then maybe 8 is the wrong index. Rather than using ADD ( because you have to sure of the ordering ), you can use

321083-screenshot-1.jpg

That way, you know for sure which index is being used.

i also have tried this way ,but is still not working. I have 14 buttons that open after different level completes. for set Boolean value of each button i have array of Boolean (0-13). the index 8 show the value of button 9.

i am saving the data as shown in pic 1.png. Or is there any other way to do it.

Ok, sorry, yes, I see it.

Then either 8 is the wrong index, or the save game is not there.

You can tell if the save game exists by looking in

C:\Users\Documents\Unreal Projects\MyProject\Saved\SaveGames

There will be a file with the same name…

yes it is exist
i have array that store boolean value true for different buttons. i have 15 buttons that check value from savegame slot name save_skin_pic array variable index (0-14).

Ok, then put a print string on the save, I don’t think it’s happening.

Hello ClockworkOcean, I have a problem and I see that you understand a lot about it.
I am trying to create a saved game so that the Lvl is exactly as the player left it (With the objects that I create in the level, in the position where he left them…) the problem is that in the save game it seems that The values are not saved in an Array element, because when I close and reopen the game it appears that it has no values.

Can you show your save and load code?

2023-02-23 14-13-19.mkv (27.3 MB)
I am carrying out tests to save the objects with a certain “tag”, but when I close and check if they are kept saved in the Save game, it appears to me that they are not. When I check it before closing the game and it appears that yes, as seen in the video

It seems you write an empty structure into a new save game

Yes, I do that so that the first time you create the save game it doesn’t have anything in the structure. Anyway I just tried to connect it and it still doesn’t work