Detecting click on specific object

Hi everyone;

I have nine cube rotating in my game. How I can stop one by clicking on it? I want it to be stopped after certain amount of time not immediately.

Thanks

Here’s an example in C#:

void Update()
{
    //Clicking left mousebutton
    if (Input.GetMouseButtonDown(0))
    {
        //Creating container for the raycast result
        RaycastHit hitInfo = new RaycastHit();
        //Making the raycast
        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo))
        {
            //Assuming animation is how you are rotating the cube
            hitInfo.collider.animation.Stop();
        }
    }
}