I am trying to swap the texture on a cube at runtime on mouse click. But I am getting errors (for lines in bold) in the following script
public class swapTexture : MonoBehaviour {
public Texture[ ] textures;
public int index;
void Start () {
}
void Update () {
if (Input.GetMouseButtonDown (0)) {
index++;
index%= textures.length;
renderer.material.mainTexture=textures[index]
}
}
}
I am getting following errors:
error CS0103 : The name ‘Texture’ does not exist in the current context
error CS0103 : The name ‘Input’ does not exist in the current context
error CS0103 : The name ‘renderer’ does not exist in the current context
What am I missing here?