I have designed a set of textures for a button (10 textures),when button is not pressed one of them is assigned to it, what i want is when I press the button ,it switches it’s texture from 1 to 10 and show every texture(Like playing an animation when button is pressed),I 've written the following code but it’s not working the way it should!
public int lenth;
public Texture[] text=new Texture[10] ;
Texture sampleText;
public GUISkin skin1;
void Start ()
{
sampleText=text[0];
}
void OnGUI()
{
GUI.skin=skin1;
if (GUI.Button(new Rect(10, 10, lenth, lenth), sampleText))
{
for (int i=1;i<10;i++)
{
sampleText=text*;*
This little code snippet is very versatile. We’ve used it for all sorts. Small movie clips, animated electric skin, anything you can think of involving multiple textures. Easily modified to fit many situations.