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

AnimationClip with custom keyframe values at runtime

Discussion in 'Animation' started by jusw85, Mar 31, 2017.

  1. jusw85

    jusw85

    Joined:
    Apr 21, 2016
    Posts:
    21
    I have a complex animation with multiple properties animating over multiple keyframes e.g.



    I would like to vary the value of one keyframe of one property at runtime e.g. varying the Rotation.y of Robot Arm Pincer 1 at 0:45. This is a one-shot non-looping animation, and the property is set right before the clip is played. The other properties remain the same.

    From what I've researched, it's not possible to access or modify curves at runtime (I'm using Unity 5.5's Animator). In that case, how would I tween the value in script, while still maintaining synchronization with the rest of the animation keyframes?
     
  2. mwillson

    mwillson

    Joined:
    Jul 1, 2015
    Posts:
    5
    Bump. I've been searching for an answer to this as well. Surely this can be done, or something effectively similar...
     
  3. Diesign

    Diesign

    Joined:
    May 15, 2016
    Posts:
    16
    Also curious about this. I am seeing that process changed a few years ago when moving from the animation to the animator system too? It seems like both require us to get the animation curve, edit it and then replace the animation curve? I am seeing that it is easier to do a lot of animation with coroutines than the animator system and that doesn't make intuitive sense to me.

    Surely the newer system can switch out a keyframe in less than 50 lines of code?