Create Advance Checkpoint system unity

I want to know logic of checkpoint

Unity C#

Like when i was killed some enemy solved some puzzles and destroy some things. Okay…
,… Then I reach checkpoint.

Then …

I killed some enemy and destroy some object and collect obs…
Clear…

Then player die,
I want to reset all the thing I was do after reach checkpoint…

And

Thinks before checkpoint will not change…

For example :- After checkpoint i was killed enemy, Trigger animation and boss is come. I want to repeat that when player died.

Like if i was store all details in file it will take time to restore everything back on possible but its not limited to position I also need to check states and live enemy’s remember i don’t want died enemy’s again.

Goted…

The general concept you’re describing is relatively simple. But to get it to work exactly the way you want can be extremely challenging.

At the simplest level, you can create a non-persistent checkpoint system by simply storing some values in a static class, and reading those values when loading a level. For example, maybe there’s a window in your level the player can break. Put an event on the window for when it breaks, and in that event set some boolean on a static class to true. The next time you reload that level, you can see if the player broke the window already, and start it off in its broken state. This is a very manual process, only appropriate if you only have a handful of objects you’re doing this with. And it doesn’t handle the case where you want to actually save this data between play sessions.

Beyond that, you start to describe a complete “save” system, where potentially every object in your game would need to have its position and rotation, along with other characteristics (is the window broken?) saved, and you’d have to restore that. That’s not simple at all. Those systems usually also need to be aware of dynamic objects that were instantiate at some point in the level, but which weren’t in the level when it started. For example, maybe you press a button and a ball falls out of something. No if you restart you’ll need to also reinstantiate that ball.

Anyway, those kinds of systems can be really complicated. Properly done, you might even need to keep track of character animations, and other things that aren’t as easy to restore as simple object positions.

If you can get away with someone simple and manual, where you just keep track of a few values, I’d recommend that. That’s what I do with my checkpoint system. I “remember” a few things about what happened while the player was in a level, store that in a static class (so that it doesn’t get lost when reloading the scene), and manually restore the values. That’s only viable for me because of the small number of things I do this with. You’ll need to decide just how much you want to store and restore.