Search Unity

Simple? Animating a value

Discussion in 'Animation' started by Cascho01, Feb 13, 2020.

  1. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    So far I was animating values by script but now I want to try Animations with AnimatorController.

    What I´ve done is:
    Providing a public float "tweenprogress" which I want to animate.
    Adding the script to a GameObject.
    Putting an animator on that object and creating an animation that writes my "tweenprogress".
    The animation takes two seconds (120 frames) and should pass a value from zero to one over that time.

    The weird part is that "tweenprogress" already reaches one after one second instead of after two seconds.
    It looks like that not the interpolated value but the normalized time of the animation is send to my float.
    Also see the console in my screenshot:



    Besides this, when I scrub the timeline in the animation window by hand, the interpolated value is correct:
    Screenshot: value = 0.5 at frame 60
     
    Last edited: Feb 13, 2020