Mecanim: transition to new animation with offset based on the first animation's progress

I’m using mecanim for 2dsprite animations. I have a sword slash in the air animation, and a sword slash on the ground animation. In the case where the character lands in the middle of the slash, I’d like for it to go from frame x on the “in air” animation, to frame x in the “on ground” animation.

I know how to do this in code. But I don’t want to litter my code with special cases if I don’t have to, so I’m wondering if it’s possible to do it through mecanim. It seems like it should be possible, but I haven’t had any luck with it. The closest I’ve gotten is to set a transition offset (0.8) that plays the last frame or so of the ground animation, which looks ok in most cases.

If not maybe I should request this as a feature.

So I figured out a way. Posting in case anyone else has the same question.

If I put the air attack and ground attack animations in a blend tree, then set the float in script to 1 for in air, and 0 for standing, it works pretty well.

It’s a little awkward to have the extra variable, but better than reworking my whole animation system just to handle one special case.

Two years later and this was extremely helpful, thank you! To clarify a bit of the details: The blend of the two animation clip replaces those two clips in your animator state machine. Then you transition to it when attacking as your normally would, and just make sure to update the float based on whether or not you’re jumping.