- Home /
Wrong Orientation Detected After Application Pause
At present, I am working on game which work for both orientation landscape and portrait. But if I change my mode to landscape by rotating device and then I press device lock button and disable my screen. After some time, awake my device again. At that time, I am getting following weird view.
Here in above image, you are clearly seeing what is actual mistake exist. When I do screen on at that time, I am getting above kind of view.
I want to set like that if at screen off time landscape orientation is running then at screen wake up time same orientation need to be available.
For testing purpose I have written something like following code but didn't get any solution.
void OnApplicationPause (bool pauseStatus)
{
Debug.Log("pause status : " + pauseStatus);
if(screenViewOrientation == ScreenViewOrientation.LANDSCAPE_LEFT || screenViewOrientation == ScreenViewOrientation.LANDSCAPE_RIGHT){
Debug.Log("enable landscape....");
Screen.orientation = ScreenOrientation.LandscapeLeft;
ActivateLandscapeObjects(true);
ActivatePortraitObjects(false);
} else if(screenViewOrientation == ScreenViewOrientation.PORTRAIT || screenViewOrientation == ScreenViewOrientation.PORTRAIT_UPSIDEDOWN){
Debug.Log("enable portrait....");
Screen.orientation = ScreenOrientation.Portrait;
ActivateLandscapeObjects(false);
ActivatePortraitObjects(true);
}
}
Please give some of your help in this.
Your answer
Follow this Question
Related Questions
Android Splash Screen starting in Portrait mode 1 Answer
Game support for landscape and portrait 0 Answers
Xcode 6 Orientation Issue 0 Answers
Difference between Screen.orientation - Input.deviceOrientation 2 Answers
iOS8 Screen Orientation Bug?? 0 Answers