Unity is lying to me about transform.position

Sorry about the aggressive title, but this error has been bugging me for years, todays I finally tracked it down after 5 hours

my object is onscreen its not moving, transform.position = (17.96, 25.26, 89.31)

now the following code

print( transform.position ); ← (16.91, 25.44, 89.74)
assert_break(); thus force unity to break
I look at the object in the editor its at (17.96, 25.26, 89.31)!!!
even though the line before it’s literally told me its at (16.91, 25.44, 89.74)

if I play the scene without assert break, the object is stationary at at (17.96, 25.26, 89.31) the whole time, i.e. its not flickering cause its moving.
So why on earth is this happening?

cheers zed

1 Like

The inspector shows the local position of a transform. transform.position is the world position.

2 Likes

never mind - I found the error elsewhere. Well that was a fun way to spend my Sunday :stuck_out_tongue:

2 Likes

Want to share with the class what the problem was, in case someone finds this thread useful?

2 Likes