Search Unity

Create an animation clip in animation track That can covert to Infinite clip

Discussion in 'Timeline' started by Suika, Jan 23, 2018.

  1. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    Hi I use Unity 2017.2.1p2

    Is there a way to create an animation clip in animation track That can covert to Infinite clip( like RecordableClip in 2018.1) ?

    thx
     
  2. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    Any one know ? If there is no way, pls let me know too. Thx
     
  3. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There's isn't a way in the public API -- which is why the recordable clip was added - but if you want to make an infinite track you can do so using reflection, or Serialized Object/Properties.

    On your track, there is a private property called "m_AnimClip", of type AnimationClip. It's accessible through an internal property called animClip.

    The animation clip should be a sub asset of the timeline asset in the asset database.
    It needs to have Generate Root Motion enabled. This needs to be done in the Inspector of the animation. The API was made public in 2018.1 (AnimationUtility.SetGenerateMotionCurves), but it exists as internal in 2017.2 if you want to use reflection.

    If you have an empty track with that field set it should show up as an infinite track in the editor in 2017.2.
     
  4. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    It work!! Thx !! But there is another problem, the animation clip that add by Reflection always start at time = 0, but the origin clip were not,

    So is there any way to edit that? or convert it to clip so I can edit by edit clip ? Thx
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There is an internal property called openClipTimeOffset that lets you offset the clip.
     
  6. Suika

    Suika

    Joined:
    Nov 19, 2013
    Posts:
    33
    Sorry openClipTimeOffset didn't work, but I found another way to solve the problem.

    So now everything work perfect. Thx!!
     
  7. Razieln64

    Razieln64

    Joined:
    May 3, 2008
    Posts:
    129
    Hi. I haven't yet looked at 2018.1. I'm on 2017.3. I am not sure it's the same thing I'm looking for but I believe it's very similar.

    I want to modify an infinite clip created in timeline by code. I'd like to be able to generate a clip procedurally and then let the user try it out and tweak it.

    The procedurally generated clip would be used as a basis.