What I want to do : When I click the button, the button gets added to a ‘disabled buttons’ array inside savegame which will be then disabled with event construct. (So If I click a button once, I want it to get disabled forever.)
I haven’t trying to make it; however, given that it is “for each” loop I would claim that each array element would be valid at that instance in time so “Is Valid” will always be true. Yes? If so, all buttons in the DisabledButtons array should be disabled. Yes?
What is the code doing that you are not expecting?
Another thing… …if the top image is just repeated for all games loaded, it would appear that each level has its own array. Given this you read that array and then add the new button. However, the new resulting array appears to be discarded in that the next time you read that game slot your change should not be there. Is that what you see? Is that the intent?
I’ve setup a test here, utilizing the save-game object, and some of the ideas that were posted in your last post.
Main Widget
This is done during the construct of the main widget.
We have created an array variable of the type GameplayTag for the purpose of this example. This array holds the entire list of achievements the player can collect rewards for. We want to loop through all our achievements/collectible rewards and create a unique widget for each of them, and deactivate whichever has already been collected by checking against the saveslots GameplayTag Container (which can hold multiple tags)
The SaveGameObject in this example purely use a gameplaytag container to hold all the tags we’ve already collected by pressing the collect button in the Achievement Entry widget (GameplayTags are safe from typos, which is great )
Her we mostly just hold a gameplaytag related to this widget’s achievement, and pass that out with our custom delegate so that our main widget can handle the reaction.
So do I have to drag array elemets to the create widget achievements? Like how do you make reward there? Is it a different variable from ‘all rewards’?
“AllRewards” is an Array of GameplayTag
“Reward” is a single GameplayTag
They’re here used as an example, and you may provide them in a different manner.
The idea is basically:
Hold an array of what is your list of achievements, which can be read by the main widget
Then when the main widget create widget entries, let it pass into the entry the data needed to identify the achievement.
This is used to pass to the save-slot once it has been collected
Let your Save-Slot have a list of already rewarded achievements.
During creation of the Entry widgets, check if the reward has already been collected, and if so, disable that entry
VB_Achievements is just a veritcal box for holding the list of achievements