Let’s say I happen to have a character, and I decide to walk around with him… I shoot a few lasers, and kick a soccer ball. Then, I press a button, and the lasers come back to life, reenter my gun, and both my character, and the soccer ball go back to their original status - All of this happening over time, as if hitting the rewind button on a dvd.
When I release the button, everything goes back to normal operation, and I am free to do something ELSE. For instance, if I am rewinding, and let go of the button while lasers are reentering my gun, the lasers start going away form the gun again. However, if I wait until they are in the gun, and gone, they never re-appear unless I fire some again. I imagine this would be possible, because as I rewind, rigidbody velocities are rewinded as well. Form there, they don’t actually “fast forward”, they simply continue normal operation with that velocity.
If I leave the scene “paused” after rewinding, I could potentially fast forward too, but if I don’t leave it paused, the current status would become “Present”, and fast forwarding would be impossible.
I’d stick to caching values such as the player’s position and whatnot into an array every frame or something, though only allow them to go back in time so far as you don’t want the array sizes to get hectic.
From there, simply backtrack each event with what you’ve stored in the array.
you have to store the data yourself, unfortunately there is no Rewind() function. unity is a nice engine, but you still need to do some of the more uncommon stuff yourself.
maybe you can think of a better way than storing positions for every object in the scene for every frame. just as an example you could store something like “walked forward for 2 seconds without doing anything else, shot 2 times but kept walking, and so on …”. this doesn’t work for every kind of game obviously (my mouse ALWAYS moves when i play 1st-person shooters for example), but i’m sure you can find a clever solution.