-
-
Save Enigo/df42edfc4b2603e550720fd2a97ba75f to your computer and use it in GitHub Desktop.
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
public class OrientationSetter : MonoBehaviour | |
{ | |
private void Awake() | |
{ | |
SetupInitialOrientation(); | |
} | |
private static void SetupInitialOrientation() | |
{ | |
if (PlayerPrefsUtils.HasOrientation()) | |
{ | |
if (PlayerPrefsUtils.IsPortrait()) | |
{ | |
if (Screen.orientation != ScreenOrientation.Portrait) | |
{ | |
Screen.orientation = ScreenOrientation.Portrait; | |
} | |
} | |
else | |
{ | |
if (Screen.orientation != ScreenOrientation.Landscape) | |
{ | |
Screen.orientation = ScreenOrientation.Landscape; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment