hi all i have a script here im trynig to change to c# but failing keep getting errors
here you will see why im confused i get error saying
Assets/C#Scripts/Player.cs(23,27): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position’. Consider storing the value in a temporary variable
For this, you need to follow the advice in the error message : Consider storing the value in a temporary variable
Let’s look at that.
if (transform.position.y < -20)
{
// build a temporary Vector3
Vector3 tempPosition = new Vector3( 3.5f, 0.2f, -0.1f);
// assign the Vector3 to the transform.position
transform.position = tempPosition;
}
This is untested and C# is not my native language =]
Here’s some links I found useful in converting between C# and JS :