get just the x position in object unity code example Example: unity get x position float x = transform.position.x;