Vector3 v = new Vector3(1, 1, 1);
v.x = 5;
Why can't I do this? I have to do v = new Vector3(5, v.y, v.z);
I assume the reason behind this is for performance. But I can't guess at why this is necessary.
Edit:
I lied, this actually does work. The Vector3
I've been working with transform.position
always returns a copy of itself, which is why setting values on it doesn't work. Some kind of Unity magic.