Transform.position.x/y/z is a read-only property. You can't modify it directly.
This should work if I understand the question correctly. By setting the X and Y values to the current position it is simply not modifying them, in case the object is not stationary on the other axes. Which I am guessing is the case.
` transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 0.7f);`
↧