Float and box positioning


I have a simple cube on my scene and I am trying to position it on different fixed positions.

I made variables such as:

var HSx1 : float = 63.0511;
var HSy1 : float = 15.60586;
var HSz1 : float = -41.152;

In the Update function, I call another function. This basically changes the position of the box to the X/Y/Z of HS1, then waits a second or two and the box has to position itself at the X/Y/Z of HS2. To do this, I use a script, partly posted below.

	case 1:
		transform.position.x = HSx1;
		transform.position.y = HSy1;
		transform.position.z = HSz1;
	case 2:
		transform.position.x = HSx2;
		transform.position.y = HSy2;
		transform.position.z = HSz2;


The problem I am experiencing is that the box actually doesn’t go to that specific location. For example, HSx1 is set to 63.0511 but once I play the game the position.x is set to -0.1134779 or some other number. I don’t understand.

What can I do so the box actually goes to the position I have set?

Have you changed the values in the inspector? That will override any constant value you’ve set in the code. If so, you can right click on the component in the inspector and select “reset”, and it will recreate the object with whatever defaults you’ve set in code.