After I’ve managed to create a save system on my game, I’ve encountered a big problem: After loading a save, or changing level, my items (food or keys) reappears
I’ve tried to create a system to delete each item when we pick them and save, but it doesn’t work …
I’m on UE4 V 4.15, and I’m planning to take the new version V 4.16.
Can anyone help me about this ?
A few things to consider what you are doing in your BPs:
-You are using Game Instance to hold your variables. GIs (Game Instances) are persistent until the game closes. So any data set into them will be reset after closing the game.
-You are setting the bools to an array in your GI, but never referencing them.
-When your level is spawned, It seems that all of your “MAIN_Inv_Pickup” items are all running the same Begin Play event. In which, I imagine, that the default value of “IsTaken?” is set to false. This means that every time they are spawned, they spawn with the default values and nothing is deleted because everything is set to false.
I wish I was in front of my PC so I could be more specific, but what I would look into is save the variables to a Save Game. And instead of “Destroy Actor”, I would just hide it. You can use GIs for level transitions if set properly. But to avoid future issues with closing and reopening the game, I would avoid this.
And I’m sure people have a better more efficient way of doing this than my ideas, but I hope this helps points you in the right direction.
And besides, when I save the game, IsTakenArray is saved to, and it works great
So with that, each item doesn’t need to hold a single variable (I just need to set the length of IsTakenArray as long as the number of items presents in the game.)