- Home /
Question by
josephquested · Jun 09, 2017 at 06:42 AM ·
camera2dresolutionaspect-ratiocamera viewport
Camera viewport should be square and pixel-perfect, regardless of player aspect ratio.
I am making a pixel-perfect 2D game, fixed at exactly 256x256 pixels. My current technique to ensure this is brute forcing the screen resolution on start. IE:
void Start ()
{
Screen.SetResolution(256, 256, false);
}
This, of course, is an awful technique. Because it makes the game window hilariously tiny. I want to be able to support different aspect resolutions at startup, while retaining a perfectly square game widow that does not stray beyond it's allowed viewport. My guess is that it will have something to do with intelligently setting the width of the camera viewport, based on the player resolution. But I don't know what that would look like in practice. I have found similar questions online but no working solutions.
Any help would be greatly appreciated. Thank you. <3
Comment