stop rotation when mouse cursor hovers over model

Hi, Just started using Unity as of yesterday and learning Java Script for the first time and have come up across my first problem.

I have got a model that is rotating continuously and I want the rotation to stop when the mouse cursor hovers over the model and then continues the rotation when the mouse isn't hovering over it no more.

would be grateful for any feedback. thanks.

You could use the functions OnMouseOver and OnMouseExit along with a boolean like so:

bool rotateObject = true;

void Update()
{
    if(rotateObject)
        //rotation code
}   

void OnMouseOver()
{
    rotateObject = false;
}

void OnMouseExit()
{
    rotateObject = true;
}