Check out example codes for "change z value unity". It will help you in understanding the concepts better.

Code Example 1

Vector3 temp = transform.position;
 temp.x = 10.0f;
 transform.position = temp;

Learn ReactJs, React Native from akashmittal.com