- Home /
found the answer
Unity 5 Screen.orientation problem
In Unity 4.6 I made a button to switch between LandscapeLeft and LandscapeRight for a multiplayer single tablet game to turn the sceen.
if (Screen.orientation == ScreenOrientation.LandscapeLeft)
{
Screen.orientation = ScreenOrientation.LandscapeRight;
}
else
{
Screen.orientation = ScreenOrientation.LandscapeLeft;
}
It worked well in 4.6, but now in Unity 5 I get only "Landscape" as result if I check Screen.orientation.
Any idea?
thanks in advance Frank
$$anonymous$$eanwhile I tried also Input.deviceOrientation, but if my game tablet lay's flat on the table I get FaceUp as result, which is not helpful.
Answer by DiebeImDunkeln · Mar 12, 2015 at 12:58 PM
ok found a solution by myself:
private string myOrientation;
void Start()
{
myOrientation = "left";
}
public void SwitchScreen()
{
if (myOrientation=="left")
{
Screen.orientation = ScreenOrientation.LandscapeRight;
myOrientation = "right";
}
else
{
Screen.orientation = ScreenOrientation.LandscapeLeft;
myOrientation = "left";
}
}
Follow this Question
Related Questions
Steamworks.net with Unity3d 5 personal? 0 Answers
Can I customize the list of labels (tags) for assets in my scene? 2 Answers
My Game Renders Awful In Android Build 0 Answers
Fill Font Characters with White? 0 Answers
Doing Scale and Rotation to a UGUI Item Scroll Rect is hiding the Item on A Physical Device. 0 Answers