i have an error with this code
transform.eulerAngles.y += Input.GetAxis("Horizontal") * 5;
error cs1612: cannot modify a value type return value of “unityEngine Transform.eulerAngles” consider storing the value in a temporary variable
i have an error with this code
transform.eulerAngles.y += Input.GetAxis("Horizontal") * 5;
error cs1612: cannot modify a value type return value of “unityEngine Transform.eulerAngles” consider storing the value in a temporary variable
You must be using C#. The error means exactly what it says. This is the fix:
Vector3 v = transform.eulerAngles;
v.y += Input.GetAxis("Horizontal") * 5;
transform.eulerAngles = v;