Is there a reason a sprite might be positioned differently depending on resolution?
I'm attempting to set up a UI grid of buttons over a grid of tiles that are game objects with sprite renderers for an in-game level editor. From what I understand, sprites are supposed to automatically scale in both size and position between different resolutions. In my editor, at 1280x720, and 1920x1080 everything is fine, but at 1600x900 all my tiles are offset from the grid. So it's not an issue of aspect ratio, it's all 16/9. http://i.imgur.com/1fUM0mG.jpg http://i.imgur.com/F3Iv4en.jpg
If it helps, this is the code I'm using to position the tiles. topLeft is the position of the top left tile and grid is the point in the grid this tile needs to be placed at. Vector3 pos = topLeft + new Vector3(grid.x tileSize.x - tileSize.x / 2, -grid.y tileSize.y + tileSize.y / 2, 0);
I have no idea why the resolution would affect the sprites like this, putting them exactly half of their width and height off from where they should be. Any ideas as to the cause would be appreciated.
Answer by TheRandomosity · Sep 22, 2015 at 06:37 PM
Literally the next day when I updated Unity to 5.2.1f1, the problem fixed itself. I didn't change anything, just rebuilt the executable, and the tiles lined up just fine. I'm assuming it was a bug that got fixed.
Not an actual solution but the issue is resolved.