Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    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:
    1,279
    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:
    5
    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.
     
unityunity