Why does the rotation value differ?

When I'm in editor mode, I can alter the transform rotation's value X to 90.0, but when I print it out in javascript it gives me about 3 different numbers each time:

  • 1
  • 1.095818E-06
  • -3.16104E-06

I had been comparing the rotations on assumption that they were using the larger numbers like 90.0, and if the number is being broken down into small units then it's could be the source of my problems.

Those numbers are all pretty much the same. It's the effect of floating point imprecision when converting quaternions to euler angles. Also, if you're using transform.rotation, that's not what you're seeing in the inspector, which is transform.eulerAngles. In any case you don't want to compare angles using ==, because of the aforementioned floating point imprecision.