Can someone help me with following code? I don’t understand why this only happens to y. The values added for x and z is not replacing the current values of x and z, which is good. So why not the same for y?
{
player = GameObject.Find("Mouse");
transform.position = player.transform.position;
// prints x: 2.1, y: -8.2, z: 11.2
transform.position = player.transform.position + new Vector3(1.0f,
2.0f, 1.0f);
//prints x: 3.1, y: 2, z: 12.2 (correct for x and z, but not for y)
}```
Okey, i think I figured it out. It seems to be a bug in the inspector. Player Y was set to -8.2 in inspector, but when I manually set it back to 0 my character/player didn’t move on Y. So it’s like it was already on 0, but the output was -8.2.