1

My app in unity is all Vertical but I have one Scene where I need it to be horizontal only. How can I do this? I want it so that when you click the button to load the scene it turns the phone horizontal, then when they go back to the original scene it will go back vertical.

Dalton
  • 23
  • 2

1 Answers1

1

Disable auto rotation in the Awake function:

Screen.autorotateToLandscapeRight = false;
Screen.autorotateToPortraitUpsideDown = false;
Screen.autorotateToPortrait = false;
Screen.autorotateToLandscapeLeft = false;

You can then change the orientation as

Landscape:

Screen.orientation = ScreenOrientation.LandscapeLeft;

Portrait:

Screen.orientation = ScreenOrientation.Portrait;

As for detecting clicks on a button, see this post.

Programmer
  • 121,791
  • 22
  • 236
  • 328