Best Practices on 2D Animation?

So I’m making a game that is a 2D top-down style game like old Final Fantasy or Zelda. So I have several images that make up my 2D sprite animations for movement and everything else. So my question is, can anyone offer any advice about the best way to store and change out the different frames?

I’ve tried it a few different ways and I’m not sure which is the best. These are the ways I’ve tried it:

  • Store all 40+ images in a tileset (combined into one image) then just using the texture offset on the material to show different “frames”.
  • Make each individual image into a material and just swap out the materials to change frames.
  • Keep each image just as a texture and change the texture out on the same material to change frames.

I’m also open to new suggestions. I’m just looking for the best way to do this, and it seems like it’s a pretty common thing to do. So how would you go about 2D frame animation?

Thanks in advance,

Here’s something I did a while back along the lines of animating a 2D character with separate frames. I made a folder named Resources in my Assets folder, then made folders accordingly where I wanted to load the resources from. This is only for a 4 frame animation, but you could use this as a reference, then take a look at [Resources.LoadAll][1] if you have something with a ton of frames, I know you can load all from a certain path, just kinda rusty. Here is my C# script that I used to animate my character though, hope it helps point you in the right direction.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class AI_Anim : MonoBehaviour 
	public Texture[] walk;
	List<Texture> frames;
	public bool animate = false;
	float delay = .07f;
	int f = 0;
	void Start () 
		walk = new Texture[]
			{Resources.Load ("Characters/Actor0/walk0") as Texture,
			Resources.Load ("Characters/Actor0/walk1") as Texture,
			Resources.Load ("Characters/Actor0/walk2") as Texture,
			Resources.Load ("Characters/Actor0/walk3") as Texture};
		frames = new List<Texture>(walk);

	IEnumerator Animate()
				yield return new WaitForSeconds(delay);
				for(int i = 0; i < frames.Count; i++)
					frames _= walk*;*_

* }*
* f++;*
* if(f >= frames.Count)*
* f = 0; *
* renderer.material.mainTexture = frames[f];*
* }*
* yield return new WaitForEndOfFrame();*
* }*
* }*