Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Why “postExtrapolationMode” property of TimelineClip is Read Only? How can I modfiy it in runtime?

Discussion in 'Animation' started by MaydayWorks, Sep 12, 2018.

  1. MaydayWorks

    MaydayWorks

    Joined:
    Aug 18, 2014
    Posts:
    5
    Hi,I want to generate a Timeline in runtime by creating a AnimationTrack and adding TimelineClips to it. All added AnimationClips will play and stopped in the final frame, while I want them to Loop forever.
    I tried to add a PlayableDirector and set the generated Timeline as its playable asset, then edit the TimelineClip which should extrapolation in Loop mode in inspector, and it works. But using codes, I found the “postExtrapolationMode” property of TimelineClip is Read Only, which leads to no way to set the clip extrapolation in Loop.
    Also I tried using reflection methods the change the property like this:
    Code (CSharp):
    1. typeof(TimelineClip).GetProperty("postExtrapolationMode").SetValue(animClip, TimelineClip.ClipExtrapolation.Loop, null);
    It seems to be work. I wonder is it a safe way to do so? and what is the offical way the change the code created TimelineClip's ExtrapolationMode?
    Thanks