Created
January 17, 2017 03:49
-
-
Save st0326s/7db81811024a4164358d6f0dd3398792 to your computer and use it in GitHub Desktop.
Unityからスマホ画面の向きの固定・解除(iOS・Android共通) ref: http://qiita.com/satotin/items/2009788da11805a4a9cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (Screen.orientation) { | |
// 縦画面のとき | |
case ScreenOrientation.Portrait: | |
// 左回転して左向きの横画面にする | |
Screen.orientation = ScreenOrientation.LandscapeLeft; | |
break; | |
// 上下反転の縦画面のとき | |
case ScreenOrientation.PortraitUpsideDown: | |
// 右回転して左向きの横画面にする | |
Screen.orientation = ScreenOrientation.LandscapeRight; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 縦 | |
Screen.autorotateToPortrait = true; | |
// 左 | |
Screen.autorotateToLandscapeLeft = true; | |
// 右 | |
Screen.autorotateToLandscapeRight = true; | |
// 上下反転 | |
Screen.autorotateToPortraitUpsideDown = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment