Skip to content

Instantly share code, notes, and snippets.

@Enigo
Created February 6, 2021 20:32
Show Gist options
  • Save Enigo/6b3d82320bb289c34665b9c9f5526f51 to your computer and use it in GitHub Desktop.
Save Enigo/6b3d82320bb289c34665b9c9f5526f51 to your computer and use it in GitHub Desktop.
public static class PlayerPrefsUtils
{
private const string Orientation = "Orientation";
public static bool IsPortrait()
{
return PlayerPrefs.GetInt(Orientation, 1) == 1;
}
public static bool HasOrientation()
{
return PlayerPrefs.HasKey(Orientation);
}
public static void SavePortrait(bool isPortrait)
{
PlayerPrefs.SetInt(Orientation, isPortrait ? 1 : 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment