So im trying to make a cube’s texture change when i press c, and i think i wrote it correctly (since i got no errors) but it just doesnt do anything!
using UnityEngine;
using System.Collections;
public class Cam : MonoBehaviour {
public bool Cameraon = false;
public GameObject cube;
public Texture reg;
public Texture cam;
void update() {
if (Input.GetKeyDown("C")) {
Cameraon = !Cameraon;
if (Cameraon == true) {
cube.GetComponent<Renderer>().material.mainTexture = cam;
} else {
cube.GetComponent<Renderer>().material.mainTexture = reg;
}
}
}
}
Can anyone help?