Strange Behaviour On Parent Component When Instantiating New Prefab Object

I have started a space shooter game for practice on Unity 2D games.

In order to fire a bullet upwards, I am instantiating my bullet prefab at the ships position plus an additional value in the Y direction to make it appear to come from the ship’s nose.
The bullet prefab is instantiated when I push the space bar.

The code to achieve this looks like this;

if(Input.GetButtonDown("Jump") && elapsedTime > reloadTime) {
        Vector3 spawnPosition = transform.position;
        spawnPosition += new Vector3(0, 0.8f, 0));
        Instantiate(bulletPrefab, spawnPosition , Quaternion.identity);
}

This works fine, but to clean up the code a little, I then decided to combine two of the lines as follows;

if(Input.GetButtonDown("Jump") && elapsedTime > reloadTime) {
        Vector3 spawnPosition = transform.position += new Vector3(0, 0.8f, 0));
        Instantiate(bulletPrefab, spawnPosition , Quaternion.identity);
}

When I do this, the player component that I have this script attached to moves up the screen to the same point as the bullet prefab instantiation point.

I can’t understand why. There is nothing telling the parent component to have its position updated to this point. Can someone explain to me why this would happen?

Thanks in advance!

@Geejayz , please check the expression “transform.position += new Vector3(0, 0.8f, 0));” in your second version of the code - in updates “transform.position” of a player’s component and move it up.
I suggest to replace the line with
“Vector3 spawnPosition = transform.position + new Vector3(0, 0.8f, 0));” so use just “+” instead of “+=”.