- Home /
Question by
andrew_196 · Apr 09, 2014 at 09:40 PM ·
c#2ddistortionaspectratio
unity2d fixed aspect ratio is distorted
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:
picfix1.png
(98.4 kB)
pichelp1.png
(134.3 kB)
Comment
Your answer
Follow this Question
Related Questions
unity2d change angular direction 1 Answer
How to make 2d distortion? 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
[Unity 2d|C#] Help with changing a sprite by holding down a key? 2 Answers