transform.position error

hey, got an error, the code is correct, i dont understand how to solve the error :/ http://pastie.org/1009827

    if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
    Camera.main.transform.position.y = Camera.main.transform.position.y + 0.1;
}
    if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
    Camera.main.transform.position.y = Camera.main.transform.position.y - 0.1;
}

line 2 and line 4 =
Cannot modify the return value of `UnityEngine.Transform.position' because it is not a variable

for ppl who are interested for the full code then : http://pastie.org/1009839

This is because you're coding in C#. In javascript the compiler lets you modify the conmponent values of transform.position, but in C# it doesn't - you have to make a whole new Vector3 and assign it in one operation.

In Javascript, the compiler basically 'hides' the fact that it is doing this for you behind the scenes.

So, what you need to do is create a new Vector3 and assign it in one go, like this:

Vector3 newPosition = Camera.main.transform.position.y;
newPosition.y += 0.1f;
Camera.main.transform.position = newPosition;

Also, for simply moving a transform's position, you can use this:

Camera.main.transform.Translate( 0, 0.1f, 0);

Also you'll need to put 'f's after every floating point number (like I just did with the 0.1).