Hey guys,
For some reason this wont work…
transform.position = new Vector3 (-5.5, 9, transform.position.y);
Its failing on 5.5 for my X value.
It doesn’t like the dot value.
How can I make this work?
Cheers in advance,![]()
Hey guys,
For some reason this wont work…
transform.position = new Vector3 (-5.5, 9, transform.position.y);
Its failing on 5.5 for my X value.
It doesn’t like the dot value.
How can I make this work?
Cheers in advance,![]()
It doesn’t like the dot value because that’s a double by default, but the function asks for a float. You have to put a little f after it like:
5.5f
The reason it didn’t care about the other is because that wouldn’t cause the number to lose precision (it’s an int by default) so it was willing to recast on it’s own.
Thank you.
I looked on the reference guide but this was not in there.
Thank you again ![]()
It’s how C# works. The Unity docs don’t cover that, since it’s already thoroughly covered on MSDN and elsewhere.
–Eric