Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    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. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    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


    Aug 18, 2014
    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?