Hello I am working on a game and it needs a fixed aspect ratio for many reasons, but I am having a problem where I change it in c# like so:
camera.aspect = 16f/9f;
but when the screen in not 16/9 it will be distorted i attempted to fix it with:
if(camera.pixelHeight < 1030){
DoSomething();
//but I do not know what to add here e.g:
pixelHeight = screen.height / camera.pixelHeight;
}
and if it is greater:
if(camera.pixelHeight > 1030){
DoSomething();
//but I do not know what to add here e.g:
pixelHeight = screen.height / camera.pixelHeight;
}
the error looks like this except it looks much more distorted in the editor and player:
but I need it to look like the unity player when you select a aspect ratio like this: