- Home /
Question by
kyhnlbyrk · Aug 13, 2017 at 09:59 AM ·
android2dmobileaspect-ratioaspect ratio
How to change Unity2D aspect ratio with scenes?
I have multiple scenes in my mobile phone, in one scene the aspect ratio must be 16:10(vertical), in other scene it must be horizontal. I made the 16:10, but when I do this, the other scene is 16:10 too. Is there a way where I can change the aspect ratio, from the code? When that scene is loaded, the aspect ratio changes.
Comment
Best Answer
Answer by eskivor · Aug 13, 2017 at 10:30 AM
try this :
to make your screen as landscape :
Screen.orientation = ScreenOrientation.LandscapeLeft;
or
Screen.orientation = ScreenOrientation.LandscapeRight;
and to make your screen as portrait :
Screen.orientation = ScreenOrientation.Portrait;
more info : https://docs.unity3d.com/ScriptReference/Screen-orientation.html