Structures are passed by value in C#, so you cannot change the x
or y
value of a Vector3
and you need to create a new Vector3
and assign it to the Vector3
that you want. However, in JavaScript, you can write it as follows.
JavaScript:
transform.position.x = 1;
C#:
transform.position = new Vector3(1, transform.position.y, transform.position.z);
3.135.196.172