How do I change the color of a 3d object in unity 5

I’m trying to change the color of a 3d object when a collision is detected. I’ve tried gameObject,GetComponentr().material.color = Color.red, but so far no luck, the object does not change color.

gameObject.GetComponent().material.color = Color.red;