Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Animation reversal

Discussion in 'Animation' started by kdarius43, Aug 8, 2018.

  1. kdarius43


    Mar 16, 2015
    Hello all I have had this issue that has been bothering me. I can hard code it and fix the problem but wanted to see if there was an easier ways. Say i have a cube that i have and animator on and and an animation. This animation goes from 0 - 100 in scale. I have another animation attached to the cube that goes from scale 100 - 0. When the cube is clicked it sends trigger to the animator to play the opposite animation. The issue i have is if the cube is animating from 0 - 100 and it is at 63 and someone clicks it again the other animation is triggered. The issue with this is instead of it going from 63 - 0 it just instantly to 100 and start going back to zero. I was wondering if there was a way to fix this in animator and animations and not have to code it in.
  2. TantzyGames


    Jul 27, 2016
    Try using transitions instead of animation clips.
    1. Create one clip of the cube at 0, and one clip of the cube at 100.
    2. Create a transition to each clip from "Any State".
    3. Set a parameter to trigger each transition.

    Something this simple would probably be much simpler just to use lerp in a script, but this method could be useful for more complex animations.