public Animation component -- I can't put an animation in in the inspector!? How do I use the Animation class?

Besides the Animator component, the manual often mentioned “Animation” as a component that can be referenced in a script and that seems very useful. For example in this entry:

public class ExampleScript : MonoBehaviour
    public Animation anim;

    void Start()
        // Rewind the walk animation
        anim["Walk"].time = 0.0f;

So I put this public Animation anim into a script of mine and it creates a field for an animation. However it won’t accept any of the animations I’ve created. They’re all 2D sprite animations, if that makes any difference. I can’t put the animator into it either. anim = GetComponent(); does nothing… so how do I actually use the Animation class?
Even if I could put something in it in the inspector, ideally I’d want to of course change the animation I’m accessing at runtime. Of course I’m most interested in changing the animation that’s currently being played by the respective animator component on the gameobject.

The animations you can create and that you’re trying to add onto your object are actually of type “AnimationClip”. The Animation component takes in AnimationClips and you create it via the Add Component button.
That system is old though and I believe Unity is trying to replace it completely with Animator Controller I believe your’re familiar with. Everything that can be done with Animation can also be done with Animator Controller. Maybe you’ve been reading legacy documentation?