Help with moving gameobject with input.mouseposition

Hi, I’m needing help with moving a gameobject on a 2d plane in front of the camera (using position.x and position.y). I am updating mouseposition and trying to assign the variables with a gameobject but I seem to be missing something. Over the many codes I’ve tried, all of them did not work.
1st: I run the item pickup function: This instantiates the item and makes it a child object and positions the item relative to the parent.

void RunItemPickup(int itmp) {
		string modelstring = pinv.invItemModels[itmp].ToString();
		if(!pickupitemmodel) {
			pickupitemmodel = (GameObject)Instantiate(Resources.Load(modelstring));
		}
		pickupitemmodel.transform.parent = (GameObject.Find("ItemPickupOrigin").transform);
		pickupitemmodel.transform.position = (GameObject.Find("ItemPickupOrigin").transform.position);
		pickupitemmodel.transform.localScale = new Vector3(.1f,.1f,.1f);
		pickupitemmodel.transform.rotation = new Quaternion();
	}

2nd: I assign the position of the gameobject to the mouse position. This is the code I am having issues with.

void ItemPickupMove() {
		if(pickupTrigger == true) {
			pickupitemmodel.transform.position = Camera.main.ScreenToWorldPoint(mousePos);
		}
	
	}

This does not seem to work, and depending on the code it either sets the position to the camera, or instantiates the item and translates the position infinitely. So in short, I need help with a code that moves the gamobject on screen and remains static in the z-position, like moving an item in your inventory. Any ideas or thoughts?

Answer has probably been in front of you the whole time - Read The Manual. :p[

Unity - Scripting API: Camera.ScreenToWorldPoint](Unity - Scripting API: Camera.ScreenToWorldPoint)

If you **Debug.Log(mousePos)** you’ll see that the z coordinate is zero, which is probably not what you want here.

Thanks Cameron! I ended up getting it!

void RunItemPickup(int itmp) {
		string modelstring = pinv.invItemModels[itmp].ToString();
		pickupitemmodel = (GameObject)Instantiate(Resources.Load(modelstring));
		pickupitemmodel.transform.localScale = new Vector3(.1f,.1f,.1f);
		pickupitemmodel.tag = "HeldItem";
		pickupitemmodel.layer = 10;
		pickupTrigger = true;
	}
	void ItemPickupMoveUpdate() {
		if(pickupTrigger == true) {
			pickuploc = mousePos;
			pickupitemmodel.transform.position = camera.ScreenToWorldPoint(new Vector3(pickuploc.x, pickuploc.y, 1f));
			pickupitemmodel.transform.LookAt(pcam.transform);
		}
	}

I had to fiddle with the attributes of the camera.ScreenToWorldPoint but it works! Now if only the GameObject can be above the GUI.Window, but thats another post at another time. Thanks again buddy.