I'm pretty new to C# and I've decided it's the language I want to mostly script with in Unity, since I'm fairly familiar with C and C++.
I've been going through doing the tutorials and converting the sample scripts to C# as I go, but I've come across something that's got me stumped. In the racing tutorial, the camera script does this inside FixedUpdate():
- transform.position.x += 5;
When I try and do the same thing in my C# script, I get the error:
"Cannot modify the return value of 'UnityEngine.Transform.position' because it is not a variable."
and yet this works fine
Can someone clue me in on what's going on? A quick google search turned up some stuff about value/reference semantics, but I couldn't quite get my head around it. Am I right that 'position' is a member variable of 'transform' that is of type struct? What's different in the semantics compared to the same thing in C++?
Thanks for the help. I'm loving Unity btw, it's gotten me back into coding at home and not just at work