How can I animate 2d sprite rotation without interpolation?

I would like to animate a weapon being swung in 2 frames - all I’m doing is changing the position and rotation of the weapon sprite. However, I don’t want unity to interpolate the rotation (generate sub-frame rotations that smooth out the animation).

How can I do this? Using flat curves does not work, and my options seem to be Euler interpolation and Quaternion interpolation (there is no none).

I would like to not have to make spritesheets for every frame of every weapon.

Right-click key, Both Tangents → Constant

Constant means that the key’s value will be constant from this key to the next. You can also keep a key constant on just one tangent (one side) so it will lerp TO or FROM the key, but remain constant elsewhere.

I know it’s a bit late but I came across this thread because I was having the same problem, and I’ve come up with a solution that’s a bit weird but seems to work and doesn’t require manually inputting the angles for each frame:

public class WeaponRotationFix : MonoBehaviour {

    float correctRotation;
    bool stopRotation;

    // occurs after animation
    void LateUpdate()
        // set the correct rotation when the stopRotation has been set by animation event
        if (stopRotation)
            correctRotation = transform.eulerAngles.z;
            stopRotation = false; // unset so this only calls at the animation event

        // set rotation each frame to the correct rotation
        transform.localRotation = Quaternion.Euler(0, 0, correctRotation);

    // called by animation event
    public void StopRotation()
        stopRotation = true;                

As long as you add an animation event for each frame calling StopRotation() then it works and you get nice discrete frames rather than interpolated sprites. Hope that’s useful to someone.

My solution is:

  1. make a public float property named “z_rotation”

  2. do in each frame:

    transform.localRotation = Quaternion.Euler(0, 0, z_rotation);

  3. animate my “z_rotation”

I’ll make an example of one dirty hack, which is available because of animation events. Suppose, we need to flip sprite horizontal in our animation. Write method:

void FlipHorizontal()
    animator.transform.Rotate(0, 180, 0);

And add events to animation which will call that method. That’s all. No interpolation occurs