How to change object material with GetComponent in Unity 5?

Hi everyone.

Does anyone know how I can change this GetComponent script, so that on MouseOver it changes the material instead of the material.color?
The error is causing my game build to crash, so any help would be great! Thanks :slight_smile:

using UnityEngine;
using System.Collections;

public class ChangeColor : MonoBehaviour {

private Color initialColor;

void Start () {
	initialColor = GetComponent<Renderer> ().material.color;
}

void OnMouseOver () {

	GetComponent<Renderer> ().material.color = Color.red;

}

void OnMouseExit() {

	GetComponent<Renderer> ().material.color = initialColor;

}
}

using UnityEngine;
using System.Collections;

public class SomeCode : MonoBehaviour
{
    public GameObject GameOBJ;
    public material Mat;
    void Start()
    {
        GameOBJ.GetComponent<Renderer>().material = Mat;
    }


}

This gave me no error so if you can assign both variables in some way it should be fine.