I’m interested in making a tile-based game in Unity. One of my main concerns with this tile game is that the game should have a 1:1 pixel ratio with the tiles, so that the tiles will always display at exactly the same size on the screen, no matter the resolution of the standalone. How do I do this? I tried this script:
@script ExecuteInEditMode()
var spriteSize = 64.0;
// set the camera to the correct orthographic size (so scene pixels are 1:1)
s_baseOrthographicSize = Screen.height / spriteSize / 2.0;
Camera.main.orthographicSize = s_baseOrthographicSize;
But it doesn’t do the trick–as I change the size of the editor window, the size of my tiles onscreen changes. So, how do I get a constant 1:1 pixel ratio in my game, such that a pixel in one of my assets from Photoshop is equivalent to a pixel on the screen of my game, and will be so regardless of the game’s resolution?