float touchPosition = Input.GetTouch(0).position.x;

Im new in unity so please bare with me. I tried this code
float touchPosition = Input.GetTouch(0).position.x;and it outputs the position of x at 70.3 after that I created a gameobject at that place and check that inspector position of x it says -1.01. Now I’m confused about the difference of the two

It is pretty simple actually. Imagine your self the touchPosition and the transform of the gameobject are two different input or i should say data.

The value of x that you get is the pixel value of touch depending upon your screen width, while the value of x for gameobject of -1.01 is the worldspace value of your object.

If you are trying to spawn an object at the position of touch you might consider using function screentoworldspace which is used to convert your screen input into the world space co-ordinates. It would be better if you go through this link:

also if want to learn more there is viewporttoworldpoint also which is more simplified form of the above

:slight_smile: