- Home /
Unity4.6.0 iOS8.1 landscape left, the buttons in the right side are not available
I have created new project in 4.6.0 and attached this script to camera object:
void OnGUI() {
if (GUI.Button (new Rect (Screen.width - 160, 10, 150, 100), "portrait")) {
Screen.orientation = ScreenOrientation.Portrait;
Screen.autorotateToLandscapeLeft = false;
Screen.autorotateToLandscapeRight = false;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
}
if (GUI.Button (new Rect (Screen.width - 160, 160, 150, 100), "landscape")) {
Screen.orientation = ScreenOrientation.LandscapeLeft;
Screen.autorotateToLandscapeLeft = false;
Screen.autorotateToLandscapeRight = false;
Screen.autorotateToPortrait = false;
Screen.autorotateToPortraitUpsideDown = false;
}
if (GUI.Button (new Rect (Screen.width - 160, 310, 150, 100), "auto")) {
Screen.orientation = ScreenOrientation.AutoRotation;
Screen.autorotateToLandscapeLeft = true;
Screen.autorotateToLandscapeRight = true;
Screen.autorotateToPortrait = true;
Screen.autorotateToPortraitUpsideDown = true;
}
}
When I click the "landscape" button in the portrait mode, the orientation becomes landscape left. Then I want to click the "portrait" button, but now the three buttons are available.
Are there some errors in the script?
Thank you very much!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613182311im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Perlin noise problem 0 Answers
Detailed terrain mesh collision 1 Answer
Android performance problems in landscape mode, but not portrait 1 Answer
Accelerometer Auto rotate Issue 2 Answers
How to make "Splash Screen" auto rotate on IPhone ? 2 Answers