How to do time reversal with Unity2D / Physics2D?

Hi guys, could you share your thought about how to do time reversal in Unity2D?
I mean, is it possible to do it with Physics2D, and if it’s not possible, what options are there? Giving up physics and using some tweener to implement reverse animation?

Here are a few thoughts.

I consider you can only replay x amount of seconds, not the whole game.

Create a manager that holds a list of object. This list implements IComparable with a Compare method that will check each object for time and activity. So for all objects it checks if it is still alive, if so, do nothing, if dead, has it been dead for more than x seconds, if so remove from the list. This allows you to revive object in your backward process that were dead recently.

If you only replay Transform then you only store your transforms in a queue. The point of a queue here is that you place the most recent at the end and remove the oldest one at the front. You then only need to play backward. If you need to record other happening, then you could use your queue but storing object of a class you defined. The class qould have Transform and other states you need to keep track.

As you go backward in your queue, first you stop recording and second you read the info. For transform you simply need to interpolate from current to next (which is actually previous), as you get to next info, you check if there has been a record for other modification, like color or it got destroyed/deactivated so now you need to reactivate it.

In order to avoid all kind of check for each object, you could have them inheriting a top class with an abstract method in which for each Subclass you implement in the proper way. Then in your backward class you just call that method for all objects regardless what it does in the implementation.

Those are just thoughts but maybe that will give some directions.