Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Set PlayableDirector.duration, Play Range On/Off and Play Range Start/End ranges from script?

Discussion in 'Timeline' started by JM_CG, Mar 6, 2019.

  1. JM_CG

    JM_CG

    Joined:
    Apr 20, 2017
    Posts:
    35
    Is it possible currently (or in a future version) to set the following elements
    PlayableDirector.duration (seems only to have a get method)
    Play Range On/Off
    Play Range Start
    Play Range End

    We're loading a scene descriptor exported out of Maya, so want to be able to match it up on load.

    Cheers
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The playable director duration comes from the duration of the timeline. You can change it using durationMode and fixedDuration properties of the timeline asset itself.

    As for the playrange, there is no API to set that - it is an editor only feature. If you want to set a playrange at runtime, you can mix the duration property above with playable director initialTime property.