get x position of gameobject unity code example Example: unity get x position float x = transform.position.x;