im trying to hold an object in front of the player in game

Im new to unity. Im making my first game and i want to instantiate an object in front of me when i click my mouse, and i want the object to stay in front of me (even when im walking around) until i click my mouse again and release it to fall to the ground. ive got my code:

if (Input.GetButtonDown("Fire1"))
Instantiate(newObject, transform.position + transform.forward * 2.0 , transform.rotation);

this only creates the block to drop to the ground. Im not sure how to do what i want. please help!!

You could parent the new object to the player (camera if you want in front of his eyes all the time, controller if just in front of his body). There are other ways, but this might be easiest. To drop it, unparent it.

To make it not fall, make sure the object has no Rigidbody component, OR click on the "Is Kinematic" checkbox of the object's Rigidbody. (Or, in the script above that instantiates the object you could write something like:

var copy : GameObject;

if (Input.GetButtonDown("Fire1"))
{
  copy = Instantiate(newObject, transform.position + transform.forward * 2.0 , transform.rotation);
  copy.rigidBody.isKinematic = true;
}

To make the object stay in view, you could parent it to the player. If there is no player object, just the camera being moved around, you could parent it to the camera itself. Then as the camera moves and rotates, the child object will move and rotate with it.

copy.transform.parent = Camera.main.transform;

Try freezing all constrains in your object, then in script put this:

copy.rigidbody.constraints = RigidbodyConstraints.None;