How do I force a mobile game to use portrait perspective?

I want to make a game only view able in portrait mode. I found screen.orientation but do I make a new script and attach it to the main camera? How do I prevent it from auto rotating and shrinking the games picture?

Yes, you make a new script that runs immediately after the app is launched.

void Awake(){
   // Forces the screen to be in portrait mode. That's it. Since it's not set to ScreenOrientation.AutoRotation, the device will NOT auto rotate no mater what.
   Screen.orientation = ScreenOrientation.Portrait;

hi…Just go to build settings…then playersettings…then under Resolution and Presentation,Set your desired default Orientation
…Oh sorry.i think u need it through script to force.

Use Screen Resolution or orientation