Search Unity

Rewinding the timeline, and Signal Emitter set to "retroactive"

Discussion in 'Timeline' started by florianveltman, Sep 25, 2020.

  1. florianveltman

    florianveltman

    Joined:
    Sep 7, 2012
    Posts:
    27
    Hi folks,
    I'm currently working on a system that allows the player to "scrub" through a Timeline. I'm using an approach similar to what's described here.

    I'm now encountering a problem where Timeline events are only fired when time is increasing. When time is decreasing, the events are not fired. This behavior makes sense, but for my purposes, I need to make sure the markers are notifying the Receiver when moving backwards through the timeline as well.

    My initial approach was to create a system following the same approach as the
    ClipNotification
    example shown in the TimelineMarkerCustomization example project, but I'm realizing this would not allow for "retroactive" firing of events, when the player moves through the timeline really quickly, skipping over certain events.

    TLDR; is there a way of extending the Signal system to check for Reactions to invoke retroactively, when time is decreasing?

    Thank you for your time
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There isn't a way to do in the general case. But if, you can live with a limitation of it only working with a custom track, you can always create your own track mixer playable that does this for you.

    The playable mixer could (inside PrepareFrame or ProcessFrame)
    - keep a list of Signal/Markers/INotifications.
    - get the Timeline time (playable.GetGraph().GetRootPlayable(0).GetTime())
    - compare that to marker time and fire notifications if the time has crossed the time point going backwards.

    You can push a notification using the PlayableOutput.PushNotification, and the playable output is available from the FrameInfo data passed to the script.

    The catch is if you use signals (or any marker that implements INotification) then timeline will automatically apply the default playable to fire notifications, so you will have two playables firing notifications.

    Not sure if that helps or not....
     
    dbdenny and florianveltman like this.
  3. florianveltman

    florianveltman

    Joined:
    Sep 7, 2012
    Posts:
    27
    Thank you @seant_unity, I’ll have a look at this approach, this makes a lot of sense! I’ll get back to the thread once I’ve tried implementing it.
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    florianveltman likes this.
  5. florianveltman

    florianveltman

    Joined:
    Sep 7, 2012
    Posts:
    27
    Ah interesting, thanks for the link! I ended up needing to set some data on the track anyhow (to simulate a "retroactive" effect on the Marker that's just before the one that fired), so having a clip on it ended up being useful in the end actually.

    The hardest part to figure out was actually the gathering of the Markers, but once that was figured out, I managed to implement something fairly quickly.

    Thank you again for your help!
     
    seant_unity likes this.