Texture changing script does nothing

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?

The method must be called “Update” (with capital “U”).

In cases like this, it’s always a good idea to just put a Debug.Log(“something”) into the code in order to check if it’s actually executed or not.