How can I make an animation out of multiple frames in 2D?

I’m trying to make my gameObject’s sprite renderer switch between sprites rapidly from a folder within my Resources folder in order to make an animation. This is what I’ve come up with so far:
#pragma strict

import System.Collections.Generic;

var spriteR : SpriteRenderer;
var Sprites = new Array();
var frameCount : int;

function Start () {
	spriteR = GetComponent.<SpriteRenderer>();
	Sprites = Resources.LoadAll("FishFrames");
	frameCount = 0;
}

function Update () {
	spriteR.sprite = Sprites[frameCount];
	frameCount = frameCount + 1;
}

Please note this is in UnityScript.

I’m new to Unity and never done animation before in it, so if there is a better way to do this, please tell me. I am using Unity 5.6

PS. There is a warning message I don’t understand in the compiler that reads:
Implicit downcast from ‘Object’ to ‘UnityEngine.Sprite’. (BCW0028)

Thanks

If you simply have all the frames of the animation, you can select all those frames in the Project window and drag them into the scene. Then the save file window will appear asking you where to save the animation. Save it somewhere inside the Assets folder and you’ll have your animation.

Next, do the following:

  1. Create a Sprite game object
  2. Add Animator component to that game object
  3. In the Project window, create the Animator Controller asset
  4. Open the Animator window
  5. Drag the animation file you created into the Animator window
  6. Press Play. At this point you should have an animation playing in the scene

Thanks, I will try this now.
PS. I’d like to clarify that i don’t have an animation file. I have a bunch of PNG’s that are frames making up the movement of my character. If i need an animation file, which ones work in unity?