Hey there,
I am developing a game, now stuck in a stage where I continue a game played already, a couple of hours or days ago.
What I have already done is, that when I click on the “Continue” button in the main menu it will display all the games played and saved, in short, will display all saved files. When a player selects any saved game it will continue from where the player quit with the same player progress and statistics ( number of gifts collected, health level and lives, etc.).
Here is the issue I want to not display the gifts and coins players already collected while playing last time. I am destroying the object once it is triggered (which means collected gift).
But in my case, It displays all the gifts and objects in the scene, when I load the scene (counting game). due to which players can collect gifts and coins every time again and again, which leads to a bug.
Need help with how to fix this issue,
As in the image gift before the checkpoint should not appear
I would suggest not saving any progress that is not completed at least until a checkpoint.
I would also suggest avoiding @thereadypunk technique, because is extremily unefficient, instead use a list of grabbed items, and create unique “ids” when generating the items (you can name them with the own ID to make it easier), so that you just have 1 script doing the hard coding.
Hi try putting a script on each collectable. With a boolean if its been collected or not. Then, instead of destroying the object, turn off its collider and sprite renderer when its collected. Now I don’t really know how to save things off the top of my head, but this link using player prefs says how to save a boolean. Do this at the end of the game on all collectable scripts. Then when you have started the game again, you can use PlayerPrefs.GetInt(“nameofBoolean”) on each script ,if that is equal to one you can turn off its collider and sprite renderer. I might have made a mistake regarding the player prefs part as im not very experienced in that, but I think this will work.