My problem is this line transform.localRotation.eulerAngles = new Vector3 (0.0f, curY, 0.0f); And its not working. Its from java source and i want it to be converted to C#.
When you request localRotation, C# gives you a copy of it. Changes made to the copy are ignored by the original. That’s because Quaternion is a struct type.
You can fix this by declaring a temporary variable:
Quaternion rot = transform.localRotation;
rot.eulerAngles = new Vector3 (0.0f, curY, 0.0f);
transform.localRotation = rot;
Or, you can just assign the value directly:
transform.localRotation = Quaternion.Euler(0.0f, curY, 0.0f);
You’ll see this same behavior with vectors (such as transform.position).