Rewind time in Unity with ease! While there are certain frameworks that let you rewind time in Unity, they are usually quite restrictive and hard to modify. I faced these problems myself when i needed to add time rewind mechanics in my game and none of the solutions that i have found were good enough. That is why i decided to start this open source project that i hope you find usefull. Time Rewinder uses highly efficient circular buffer implementation to store and retrieve the rewinded values.
Customizability is one of the main points of this project, so it can be used in any of your custom Unity projects and you can track and rewind anything you want, even Shaders!
Straight from the box you can start rewinding Object active states, Transforms (position, rotation, scale), velocities, animators (also all animator layers and parameters), audios and particle systems.
You have two options how to install it into your project.
- First option is to download prepared Unity package in Github release section. After download, open your Unity project and simply open the downloaded package, import dialogue window should appear (Unity should automatically associate the package with itself). If it didnt work out for you, you can also import it thru Unity package manager.
- Second option is to download this sample project from Github and start using it, or just import the TimeRewinder folder under Assets/TimeRewinder into your project
Note: Unity versions 2019+ are officially supported
TimeRewinder supports two types of rewinds.
- Instant rewinds where you rewind time by specified amount of seconds
- Rewinds with previews
The latter of the two is definitely more interesting option, cause you can freely choose which snapshot you can return to after you spectate these previews for yourself. This is especially helpfull if you want to give more control to player with rewinding time. As shown in demo-scene examples, player can choose on the time axis the exact moment he wants to return to, while the tracked attributes are paused. The showcase of this mechanic is shown right below. I think, this is also unique feature of this project, because i havent found a similar functionality in other Time Rewind frameworks.
The classic functionality to rewind time by holding button, which you probably already know from other solutions is also here. These two types of rewinds inputs are prepared straight from the box, but it would be very easy to design completely new rewind input system. You would only have to call corresponding methods, that are all prepared and documented for you.
Detailed steps how to use TimeRewinder are described in documentation and all important parts of code are also documented.
If you still face any problem, feel free to contact me, i can help you out.
In demo-scenes there are few examples of time rewinding, as well as two examples of tracking and rewinding custom variables. I recommend you look into it, so you get the idea how everything is connected. Here comes few other videos showcasing rewinding time from demo scenes
Particle_Audio.rewind.mp4
Custom_Object_Scale_Rewind.mp4
DynamicProjectilesRewind.mp4
Dinosaur_Animator_Rewind.mp4
ShaderRewind.mp4
And here is example and maybe motivation how it could look in actual game (mobile game), where you customize it for your needs :)
Time_Rewind_Promo.mp4
Here you can watch nice video by SpeedTutor covering this asset
This asset is completely free under the MIT license, so you can use it as you wish :)
If you like my projects, please consider buying me a coffee to support my work. All donations will be greatly appreaciated :)
The main propeler of this project is my released game where you can find this rewind system in practice. This physics based puzzle game is available for free on Google Play.
Thank you if you decide to try it out :)