- Home /
js to C# - Transform
Hi! need help to js to C# convertion:
Transform t = child.transform;
t.position.z=0;
error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position'. Consider storing the value in a temporary variable
Comment
Best Answer
Answer by beriss · Oct 11, 2012 at 01:37 PM
You can't assign a value to x, y or z variables at transform like as js in C#. You should define a new Vector3 for changing value manually.
t.position = new Vector3(t.position.x, t.position.y, 0f);
Le sigh. I just don't have the reflexes for the easy ones anymore :-(
Your answer
Follow this Question
Related Questions
Need help converting js to C# 1 Answer
js to C# - 0 Answers
js to C# - Instantiate(scoreParticle, object - Vector3(0,0,0.3), Quaternion.identity) 1 Answer
Can this be converted to C#? 1 Answer
Distribute terrain in zones 3 Answers