Quick Bullet Instantiation Problem

I want a bullet to instantiate in front of my character.

var newBullet = Instantiate(bullet, transform.position.forward + 6 , Quaternion.identity );

Is what I have. I know transform.position.forward needs to be replaced with a Vector3() thing or something like that but I don’t know how to do it.

This has been driving me crazy for like an hour.

transform.position is the current location of the player, while transform.forward is the vector pointing from the player towards the direction to which he is facing. There is no such thing transform.position.forward. If you want the position right in front of the player, you need to add vectors, add the current player position with the vector pointing forward, and you’ll get the position one unit in front of the player. If you want more/less than one unit, you need to multiply the forward vector by the distance you want. Here’s the code:

var distanceFromPlayer = 1; // set this to be how far in front of the player you want the bullet.
var newBullet = Instantiate(bullet, transform.position + transform.forward * distanceFromPlayer, Quaternion.identity);

var newBullet = Instantiate(bullet, Vector3(transform.position.x, transform.position.y, transform.position.z + 6) , Quaternion.identity );

Vector3

Transform