Search Unity

PlayableGraph duration calculating or updating

Discussion in 'Timeline' started by daxiongmao, Aug 24, 2018.

  1. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    I am taking a playablegraph generated from a timeline.
    I then remove some of the playables from it.

    This should result in the overall duration changing based on which playables are still connected.

    But the timeline duration never changes. This is ok, if i could at least get the new duration of the playable graph.

    I can't seem to find anyway to get the overall graphs duration. I see where I can get/set a playables duration.
    But looking at the playablegraph visualizer the playables have durations but they do not add up to the total time. Due to overlaps etc.

    Is there a method or a way to calculate a graphs duration?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    No, there isn't. When the graph is built, the root node is assigned the duration of the timeline, it's not based on the playables in any way that would allow you to re-calculate it.
     
  3. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    I still have the timeline asset. I suppose I could walk all of its tracks and clips and be able to look at their end times? Ignoring the ones I would disable to calculate the new duration.

    I had a way to mute the tracks before playing but didn’t like it because it modifies the asset in the editor.

    On a side note how do the playables in a graph know when they should start? Do they not have some start end times? Is that only stored in c++ side?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The Timeline Playable has a built-in scheduler that handles activation and local time and has times for playables (not necessarily clips). It could be used for re-calculating duration, but it's not accessible in an API at all.
     
  5. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    It seems it may be better to just have multiple timelines then.

    Thanks