Transform.position gives random values?


My transform.position seems to give me really wierd values. I have a cube which just sits at its position, and every time I print out transform.position.x for example, the position is different. Why?

For clarification I get like from -30 to 40

EDIT: script

print(" Player Position x: " +
transform.position.x); print(" Player
Position y: " + transform.position.y);
print(" Player Position z: " +

EDIT2: I forgot to explicitly do “toString()” on the transform. I thought it was implicit by C#

EDIT3: I tried to write out the float values and they do Indeed change all the time! why on earth is this?

EDIT4: for example this gives bogus results:

ss.Position.X = transform.position.x;
print(" posx: " + ss.Position.X.ToString());

Looks like either you’re not referencing the correct transform (meaning the MonoBehaviour with your code is not attached to the cube), or you have that same MonoBehaviour attached to multiple objects, other than the cube (and thus you get the coordinates of all those objects).