I want to set orientation of device to PortraitUpsideDown.
For this purpose, I have written some test code. Here it is :
void Update ()
{
if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft && Screen.orientation != ScreenOrientation.LandscapeLeft) {
Debug.Log ("landscape left");
Screen.orientation = ScreenOrientation.LandscapeLeft;
} else if (Input.deviceOrientation == DeviceOrientation.LandscapeRight && Screen.orientation != ScreenOrientation.LandscapeRight) {
Debug.Log ("landscape right");
Screen.orientation = ScreenOrientation.LandscapeRight;
} else if (Input.deviceOrientation == DeviceOrientation.Portrait && Screen.orientation != ScreenOrientation.Portrait) {
Debug.Log ("portrait");
Screen.orientation = ScreenOrientation.Portrait;
} else if (Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown && Screen.orientation != ScreenOrientation.PortraitUpsideDown) {
Debug.Log ("portrait upside down");
Screen.orientation = ScreenOrientation.PortraitUpsideDown;
}
}
Here in this all orientations condition become true only for 2 times. While PortraitUpsideDown become keep on running when I set my device to that orientation.
Why it is not running as like other orientations code?? Please give me your suggestion for this.
Is it possible android device not contains that orientation?