Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Custom playable track GetDuration() returns 0

Discussion in 'Timeline' started by BPSRyan, Aug 8, 2019.

  1. BPSRyan

    BPSRyan

    Joined:
    Oct 3, 2018
    Posts:
    1
    I've created a custom track asset and a custom track clip which work fine except for when I attempt to retrieve the duration of the clip like so;

    Code (CSharp):
    1. float progressRate = (float)playable.GetTime () / (float)playable.GetDuration();
    GetTime works fine and returns the current time in the clip but GetDuration returns 0.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    909
    Is that playable for a clip or mixer? If it's the playable for a clip, that's odd, and likely a bug.

    The duration isn't set on a default mixer playable, but you could do that in CreateTrackMixer() if you need it. But, the time on a mixer playable isn't necessarily synced to the timeline time.
     
  3. ryanas

    ryanas

    Joined:
    Oct 2, 2013
    Posts:
    4
    Seems like it was an issue with a custom Playable track that was also adding an activation track to the graph. It seems by doing this, GetDuration() was returning 0.