- Home /
I thought I was doing this right, but it gives me an error.
So I have the following lines in my script
Vector3 temp = transform.localRotation.eulerAngles;
temp.z += turnAngle;
transform.localRotation.eulerAngles = temp;
By doing this I thought I would get around this error "Cannot modify a value type return value of `UnityEngine.Transform.localRotation'. Consider storing the value in a temporary variable" but it still gives me this error. I looked around the forum and I keep seeing the same answer, it doesn't work for me in this situation though. If anyone can help it would be awesome.
This is the way to solve the error you are getting. $$anonymous$$ake sure your script changes have been saved. Double click on the error in the Console and look at the line to verify you don't have the error in multiple places. If you still have the problem, past the entire script here along with the error message and a comment next to the line that reports the error (as a comment or as an edit to the original answer)..
The line in question was the one I posted. Te code was saved. I really don't want to post my entire script, it's over 1000 lines and there would be more questions tan answers. I just changed the script to not do it this way.