Dragging a 3D object and limiting its Y position

I’m using this script that I found/modified to move a 3d object by clicking and dragging it. It works but I have one major flaw: I want to ensure that it never moves along the Y axis, only the X and Z. My game is an isometric 3D grid style game.

Here is my code. As you can see I will always set the Y to 2f as I don’t want the concept of up/down, just left/right. The issue this creates is that after moving a few units, my mouse and the object I am dragging will no longer be together. I believe this is because my mouse is still moving in the Y plane. What I would like to resolve is that the cursor and game object being dragged remain in unison.

using UnityEngine;
using System.Collections;


public class Drag : MonoBehaviour {

    private Vector3 screenPoint;
    private Vector3 offset;

    /**
     * Mouse is cilcked
     */

    void OnMouseDown() {
        Vector3 mouse = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z);
        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(mouse);
    }

    /**
     * Mouse is dragged
     */

    void OnMouseDrag() {
        Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z);
        Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
        curPosition.y = 2f;
        transform.position = curPosition;
    }
}

It seems like this problem would be solved by using a better method of getting the target position. Instead of using Camera.ScreenToWorldPoint you should instead use Camera.ScreenPointToRay to get a ray then find where the ray intersects with the plane y=2. For example

void Update(){
   Plane plane=new Plane(Vector3.up,new Vector3(0, 2, 0));
   Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
   float distance;
   if(plane.Raycast(ray, out distance)) {
      transform.position=ray.GetPoint(distance);
   }
}