Here’s my code:
‘function Update () { if(GetButtonDown(“Jump”)); { transform.position.z += 1.0; } }’
It keeps saying that it ‘expects :, but found+=’ All that I want it to do is move the object foward 1 unit on the z-axis. If you have better code, that would be greatly appreciated.
Two errors in the if (; after the condition, and missing Input. before GetButtonDown). That’s the right way:
function Update () { if(Input.GetButtonDown("Jump")){ transform.position.z+=1; } }
if(GetButtonDown(“Jump”)); ← Remove this semi-colon.
Also, store the position in a variable, edit it there, and put it back in. You can’t edit transform.position.z directly.