I round my transform.position to the nearest integer at the end of every frame so it's never a decimal number. I would like to know if there's a way to make unity store the position in ints instead of floats to prevent floating points precision problems.
Answer
No, you can't do that because Unity is doing all its internal calculation in float
.
But if you would like to implement your game mechanics completely with integer arithmetics, you could write your own Vector3Int
class, use it for all of your game mechanics, and then have each of your game objects write its Vector3Int-position to transform.position
in LateUpdate()
.
No comments:
Post a Comment