How do I modify the current transform?

I am trying to take the current transform of my object, and add 5 (or some number) to the Y axis. Right now I am doing this:

transform.position.y += 1;

With that, my object just starts moving up in the air forever. How can I accomplish what I need?


Its easy here the script :

in c# :
transform.position = (new Vector3(transform.position.x,transform.position.y +1,transform.position.z));

You want to add a value once?

function Update (){

function NewPosition(){
    transform.position.y += 5;

NB: Just make sure to set ‘condition’ to false, or make it non-recursive(so it does not execute ‘NewPosition’ more than you want it to).

Just make sure you only execute the code once. You could also use booleans, but well that is preference.