How can I make the game object follow the mouse?

I want the newly instantiated game object (the name of the object is DragObjectCard) to follow the mouse, please help. I have tried multiple different methods but none worked. Is there any way to do this. Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreateObjectDrag : MonoBehaviour
{
    public GameObject DragObjectCard;
    public GameObject ObjectCard;
    public GameObject target;
    public Vector2 position;

    public void OnMouseDown()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            GameObject newDrag = Instantiate(DragObjectCard);
            newDrag.transform.position = new Vector2(ObjectCard.transform.position.x, ObjectCard.transform.position.y);
        }
    }
}

Have you tried using Input.mousePosition to get the mouse’s position? also using GetButtonDown would snap the object directly so use GetButton() and Vector3.Lerp for help…

  1. Input.mousePosition
  2. Input.GetButton
  3. Vector3.Lerp

Im not sure exactly how to implement it so you can either figure it out yourself or wait for an more educated answer