- Home /
Problem with transform.position on unity 3D,Transform.position not working as expected unity3D
So I have experience with 2D games on unity, but while making my first 3D game, i got a very unexpected problem. When changing the transform.position of a gameObject, by incrementing or decrementing a certain coordinate by just a bit, the position changes dramatically on all coordinates. So for example, if I say : transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 0.5f); or something like that, all coordinates of the gameObject change, and very dramatically (the object just goes out of the screen). I think this has to do with the camera position or something? I've tried using the Camera.main.WorldToScreenPoint and all that, and it kinda helps a bit, but when i change the z position, y position changes as well even though I'm not altering it in my code. Does anyone have this problem as well? If someone knows how to fix this, it would be much appreciated, Thank you!