- Home /
Question by
casualbanana · Feb 04, 2014 at 06:24 PM ·
cameraplaneaspectratio
Plane to scale with Aspect Ratio/Camera/?
Hello, I am making a 2D game and I need help scaling my Plane to fit the screen no matter the aspect ratio, etc, it is set to.
Comment
Answer by robertbu · Feb 04, 2014 at 06:35 PM
When changing to different aspect ratios, Unity changes the width of the world viewed. The height remains constant. So as a quick and dirty solution you can do scale the height of your plane to exactly match the height in the game window and then do this at runtime:
transform.localScale.x = transform.localScale.y * Screen.width / Screen.height;