what is the best idea to remember which enemy killed or which pickup got after loading a scene again?

Hello all,

I just want to know what is the best way to save which enemy is died before and which pickup used before after player exit the game and load the game again?
I know I can use serialization. but store what? One idea came to my mind is as player killed an enemy or picked up something then tag change to “killed” or “used” and whenever game saved the tags of objects save and later a script delete all the game objects with tag “Killed” and “Used” as game loaded next time.

I am beginner so if there is better way please let me know.

if this the right way then I think I should use array to get all the enemies and pick ups in each scene as those are different in each scene?

Thanks for any help

You could find a way to have a unique id for each enemy/pickup and store an array of ids killed/picked up to save and load through plays. Alternatively, you could save positions of leftover enemies/pickups and instantiate them on load. Depends how you have set up your scene.

It depends on how many enemies and pickups there will be.

If there are only a few, using PlayerPrefs would suffice.

If not, the data should probably be saved to a file.

Those are the two methods that I know.

While searching for other ways to save data, I found this guide from Unity, this should help you.