I have an animator with a few animations in it. These are very basic animations, just changing a transform to slide a sprite around in a cutscene. The issue that I'm running into is that when I transition from one animation to the next it will try to smooth out the animation differences. So if I have something move off the right of the screen, then with the next animation come falling from the top of the screen, it will first quickly slide to the new position.

I've tried to change the last frame of the first animation to Right Tangent -> Constant, and the first frame of the second animation to Left Tangent -> Constant. It didn't make any noticeable difference.

I also set up two functions (one for X, one for Y) to set the position at the beginning of the second animation, but only one of them were called, and it didn't seem to do anything.

So, how do I get an animation to snap to the starting values of the new animation after a transition?

  • \$\begingroup\$ sounds like you want a teleport, \$\endgroup\$ – ratchet freak Dec 5 '14 at 23:57
  • \$\begingroup\$ Basically, yes. That's really easy to do during an animation, but I can't seem to figure out how to make it happen over a transition. \$\endgroup\$ – Califer Dec 8 '14 at 21:42

I finally figured it out.

Unity animator screen

After selecting the animation transition you can see in the inspector a section with some bars. This shows how long the transition between the two animations will take. You can slide the bar over so that it shows 50%, telling you that the transition will be instant.

Or is it? Select the dropdown next to the padlock at the top right and select debug. The field that we want to change is Transition Duration. Set it to 0 to make it instantaneous.

  • \$\begingroup\$ Thank you very much for pointing out the Debug mode! I had been fighting with the animation speed of some UI elements for a couple of days, now everything's fine. \$\endgroup\$ – Niriel Dec 31 '14 at 13:56

You might just try hiding whatever it is until the frame where it's in position. Otherwise, it sounds like you want a Broken animation curve.

enter image description here

See also: Unity Manual: Editing Curves

  • \$\begingroup\$ Right, as I mentioned in the question I'm setting the right and left tangents to be Constant, which gives a Broken animation curve. The issue is that I have two different animations and when I transition from one to the next it seems to ignore that the last and first frames are broken and smoothly changes the gameobject to match the new values. \$\endgroup\$ – Califer Dec 8 '14 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.