In my hierarchy, I have:
- Main camera
- Empty game object named “Level”
I’ve also created and attached a simple script to Level which is meant to load dungeon tile prefabs, generate a tilemap, and lay out the tiles in 3D space to make a seamless dungeon. The problem is, whenever I programmatically assign a position, rotation or scale to any given tile, I get massive floating-point errors between 0.00001 and 1.3, which leaves a visually noticeable unaligned tile layout.
I have even tried explicitly casting these values into integer values, checking in the debugger that they are indeed the expected values, and yet, after assigning them to a transform, they still show up slightly off in the inspector. However, when launching the script and then manually setting these values within the inspector, all the tiles line up perfectly and everything looks as expected. So the issue only occurs when assigning values to transforms within a script…
What is the cause of this madness, and what can be done to fix it?