I am trying to develop an Android app in Unity3d which needs the screen to change orientation when going from one scene to another.
I've added this code to the script attached to the first scene:
void Start()
{
Screen.orientation = ScreenOrientation.Portrait;
}
And this is attached to the second scene:
void Start()
{
Screen.orientation = ScreenOrientation.Landscape;
}
I assume that this should force the screen to rotate and stay in the specified rotation. However, when I go from scene 1 to scene 2, it does not force the orientation on scene initialization, instead, if I am switching from the first scene to the second, the screen stays in portrait orientation as long as I don't move the device. When I move the device in any direction, the screen changes to landscape orientation and stays locked in landscape. For whatever reason, this does not apply when going from scene 2 to scene 1: the screen rotates properly, no matter its previous rotation. I find this really frustrating as the UI in the second scene is designed to be viewed in landscape mode and it is inconvenient to move the device every time you try to change scenes. So am I missing something or is this a bug?