Instantiate object in front of player?

Hi there!

I’m trying to instantiate a prefab in front of the player. What I currently have looks like this:

		if(Input.GetKeyDown(KeyCode.E))
		{
			 Instantiate(meleePrefab, new Vector3(0,0 +2), transform.rotation);
		}

It’s supposed to be placed 2 units in front of the player’s current position. But this will place the object in the world position of 0,0,2.

How do I make it find the players current position and then place it 2 units in the z-axis from the players position?

Thanks!

if(Input.GetKeyDown(KeyCode.E))
{
Instantiate(meleePrefab, transform.position+(transform.forward*2), transform.rotation);
}

if you want to use new vector 3 to spawn object in front of your player transfom.position enable the object to spawn at player position no matter the player goes by adding new vector three you define far the object to spawn at player position by specify the coordinate xyz
and Quaternin.identity if you want you object to spawn at default rotation use Quaternion.identity

 if(Input.GetKeyDown(KeyCode.E))
         {
              Instantiate(meleePrefab,transform.position + new Vector3(0,0 +2,0),Quaternion.identity);
         }