I’m making a 2D game where the camera is supposed to be static and have a problem with the “resolution” of the camera. Whenever I stretch the Game window the area you see expands with it so I tried to solve it with this:
void CamSize()
{
float A=1280/cam.pixelWidth;
Debug.Log(cam.pixelWidth);
cam.orthographicSize=5*A;
}
which runs in FixedUpdate()
I get this error:
Screen position out of view frustum (screen pos 14.000000, 4.000000) (Camera rect 0 0 1337 674)
UnityEngine.SendMouseEvents:smile:oSendMouseEvents(Int32)
I really don’t know what else to try as I googled this and it went to changing the sprite’s pixel per unit and changing the camera’s size to half the resolution’s height which would effectively break the game totally.
Do I just give up with this and let the view stretch how much it wants or is this possible to fix as the
cam.orthographicSize=5*A;
doesn’t constantly change it. It just goes between 0 to 10 pretty much snapping 0,5 and 10.