Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

A few questions about custom playables in Timeline

Discussion in 'Timeline' started by Rtyper, Sep 20, 2017.

  1. Rtyper

    Rtyper

    Joined:
    Aug 7, 2010
    Posts:
    393
    I'm working on making my LipSync Pro plugin compatible with Timeline at the moment. Eventually, I'd like to actually incorporate the playables API into the whole system, but as a stop-gap for now I've created a playable that just exposes a reference to a saved LipSyncData (clip) object instead.

    I've noticed that there's a few nice features some of the built-in tracks have that I'd like to replicate though:
    1. The Add From... dropdown that then lets you choose an Audio/Animation clip for the new clip before adding it.
    2. The ability to set a max duration or prevent dragging the start further back than the length of the animation clip. Is there some way to do this, or even fixed-duration clips?
    3. Triggering something when a playable in the timeline starts playing rather than every frame. LipSync has Play and PlayFromTime methods that will work nicely. I've found the OnBehaviourPause and Play methods in PlayableBehaviour that would work, but as far as I know I can only access the track binding from ProcessFrame.
    Other than that, it's a nice system! I'm looking forward to using it more in my own projects as well!

    Cheers.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    909
    Thanks for the feedback. 1 and 3 are definitely on our radar, and will hopefully have improvements in those areas in an upcoming release. Our goal is to provide customizers of Timeline better access to timeline-specific information from within their clips and behaviours.

    As for #2 - we don't support fixed-duration clips (it's a good feature request though), but what you can do is in your PlayableAsset representing the clip is override the duration property, to return the length of the LipSyncData. This will make the Reset set the clip length to that length, and when the user sizes the clip larger, the clip will show 'Hold' in the region past the length.

    If you want to support looping, you can do so but implementing ITimelineClipAsset and providing your own ClipCaps. Instead of 'hold', it will show 'loop' and give you the loop block visuals.