[SOLVED] Setting GameObject position via transform sets it on the wrong Z-coordinate.

var projectileTransform = Instantiate (projectile) as Transform;
                                        projectileTransform.position = Camera.main.ScreenToWorldPoint (transform.position);

It’s meant to create a projectile from the player character.
It sets it on Z = -8 when the player character is on Z = 0.

projectileTransform.position = transform.position;

transform.position is already a point in World space. You don’t need to convert it.

1 Like

Thanks! That fixed it!

1 Like