I have been working on this code for school that handles animating 2D sprites on the 3D screen, just like a GUI. But I only have one sprite showing on the screen and I want to be able to animate it with the rest of the pictures I have (about 10). Here is the basic class I am working on:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class AnimateSprites : MonoBehaviour {
public Texture2D mSprite;
public Rect r_Sprite;
void OnGUI()
{
GUI.DrawTexture(mSprite,r_Sprite);
}
}
How can I get this to loop the rest of my images? I know I have to go about making my sprite texture into arrays and also have a method which loops them. Can anyone help direct me on what my step(s) should be? Thank you in advance!