Change the "y" of a variable

Hello, like it says in the title, is it possible to change the y of a variable.
Current i have it like this

Cam.position += Vector3.up * Height;

i have a cam variable ( in C#) and a Height variable.

but what i have doesnt really work to well

is it possible for something like this?

Cam.position.y = Height;

Cheers :slight_smile:

Cam.position is a property, so you cannot edit .y directly unfortunately. This is what you have to do

Vector3 pos = Cam.position;
pos.y = Height;
Cam.position = pos;

In Javascript (Unityscript) they found a workaround, but in C# you have to do like this.