using UnityEngine;
using System.Collections;
public class texturechange : MonoBehaviour {
public Texture[] myTextures = new Texture[5];
int maxTextures;
int arrayPos = 0;
void Start ()
{
maxTextures = myTextures.Length-1;
}
//void Update ()
// {
// if (Input.GetKeyDown(KeyCode.T))
// {
// renderer.material.mainTexture = myTextures[arrayPos];
//
// if(arrayPos == maxTextures)
// {
// arrayPos = 0;
// }
// else
// {
// arrayPos++;
// }
//
// }
// }
void OnGUI ()
{
if (GUI.Button(new Rect(15,15,100,50),"textures"))
{
if(Input.GetMouseButton(0))
{
renderer.material.mainTexture = myTextures[arrayPos];
if(arrayPos == maxTextures)
{
arrayPos = 0;
}
else
{
arrayPos++;
}}
}
}
}