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.

try this :

to make your screen as landscape :

Screen.orientation = ScreenOrientation.LandscapeLeft;


Screen.orientation = ScreenOrientation.LandscapeRight;

and to make your screen as portrait :

Screen.orientation = ScreenOrientation.Portrait;

more info : Unity - Scripting API: Screen.orientation