Game Development Reference
In-Depth Information
Changing struct properties by value versus
by reference
Structures are passed by values in C#, so you cannot change the x, y, or z value of a Vect-
or3. 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 user:
transform.position.x = 1;
// C# user:
transform.position = new Vector3(1, transform.position.y,
transform.position.z);
Search WWH ::




Custom Search