Rewind or previous gamestate

Hey guys I only started unity about a month ago and have managed to set up a level but have ran into a issue that I am unsure how to go about it.

Basically I have a tutorial players have to follow instructions and click on items (which then play an animation of the item clicked). I want to create a button that will either load the scene at the previous animation or rewind scene (like if they want to watch it again).

Issue is I am afraid I am just not sure how to go about it or even in the general direction to look ( i have managed to make end game and restart game buttons but the previous/replay previous animation seems to have me stomped. Would this be something for player pref (i am about to research this more) or would it be better to find a way for unity to save gamestate at the start of each animation and then have the button load the previous gamestate?

Any help or guidance would be greatly appreciated.

So you want to be able to replay an animated tutorial? I’d recommend just setting up a completely separate scene for that, and just load that scene whenever you want to show or ‘replay’ it. Every time you load a scene it returns to its default state and will play as if it were the first time loading the scene.

It also seems that you have a multi-staged tutorial, and you wish to be able to jump to different ‘checkpoints’ during the scene. This isn’t as easy, but isn’t difficult either. I’m not sure how your game is set up, but based on how it is there’s several options you can follow.

First off, everything is easier here if the player HAS to follow a specific pattern. Like if you were playing tic-tac-toe, the played has to move in the bottom right spot first. This enables you to load up the first checkpoint knowing it will always be the exact same. With that established, all checkpoints are the exact same in any play-through. What happens in-between checkpoints doesn’t really matter.

Back to how to achieve this! If you do have a game where things move around (we’ll keep using TTT as an example), you can have a script that knows the checkpoint positions of each object, and just destroy current objects and instantiate objects to these preset positions. By instantiating a new prefab, it should also reset the animation state for that object, making everything brand new!

If you have something where nothing moves, but everything changes animation states, such as if… there was a tree that would animate to grow over time. Lets say you’re at state 4 being a tree with fruit, and you want to go to state 2, being a sapling. That can be achieved with script by either having a rewinding animation and playing that one, or by using CrossFade to achieve it for you. Here’s another link on that kind of stuff too.

Hey @oStaiko

Sorry for my late reply, thank you very much for your input. I got the complete scene restart done easily enough however it was the checkpoint that was hanging me up. Thank you for your very thought out explanation. Your explanation in your 4th paragraph is exactly what i need to do. Well I am off on researching and figuring out such a script. Thank you again for pointing me in the right direction.