0

Set different timelines for characters

Michał Zardzewiały 1 week ago • updated by Giovanni Sales 3 days ago 1

Hi guys, I followed tutorial to make my own game and I am stuck on whiteboxing test level. My question is:

I want to have an option to use rewind like i.e. Prince of Persia, so I can rewind mistake made by player- that means that whole world would rewind, not just enemies (in my case not enemies, but green jelly-boxes). I can't use global time, because if I copy code from

Clock clock = Timekeeper.instance.Clock("Player");

there's an error saying that I can't use clock twice. Any ideas (I am rather newbie, so some detailed-as-for-moron ideas are really welcome)?

EDIT: I've created Global Clock for Player, so other button rewinds whole time, including main character, but here's different question: is there a way to stop rewinding automatically, let's say, after 5 seconds? Right now I have to use another button to "play" world in normal timeline

Yes, I know about Recording Duration in Timeline, that solves one problem, but it would be awesome to automatically play game after that Duration without need to push another button ;)

Chronos Version:
Unity Version:

Use a timer that receives unscaledDeltaTime, when the timer reaches the value you want (5 seconds), stop rewinding time

check the pseudo code below

float timer = 0;

Update(){

     timer += unscaledDeltaTime

     if(timer > 5){

        stop rewinding

    }

}