I am trying to rotate the camera in my game using this code,
Vector3 temp = MainCamera.transform.rotation.eulerAngles;
temp.x = 50.31731f;
temp.y = 90.0f;
temp.z = 0.0f;
MainCamera.transform.rotation.eulerAngles = temp;
(MainCamera is a GameObject)
but it comes up with the error message
*"Assets/Scripts 2/PlayerController.cs(219,54): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.rotation'. Consider storing the value in a temporary variable"*
even though I followed exactly what it showed on other posts and what worked in other instances taking place in the same script.
↧