Hi guys, I'm pretty new to Unity and C#. I am just making a basic movement script and I have forward and backwards working as I would like them, however with left and right I have been using the following code:
if (Input.GetButton("Left"))
{
transform.localEulerAngles.y += rotateSpeed * Time.deltaTime;
}
Which gives me the following error:
`Cannot modify a value type return value of`UnityEngine.Transform.localEulerAngles'`.
I have seen something about this before and it suggested adding the below code, I added it just below update() but I still get the same error:
transform.localEulerAngles = new Vector3(
10f,
transform.localEulerAngles.y,
transform.localEulerAngles.z
);
Any help and an explanation would be much appreciated.