gameObject.GetComponent<Renderer>().material = newMaterial;
// in the Start() method Material yourMaterial = Resources.Load("red", typeof(Material)) as Material;