MayHeCome/Assets/Exoa/Common/Packages/UIElements/Editor/Utils/OrientationExtenseions.cs

25 lines
632 B
C#
Raw Normal View History

2024-12-18 09:55:34 +00:00
using System;
using UnityEngine;
namespace Exoa.Utils
{
public static class OrientationExtenseions
{
public static DeviceOrientation Get()
{
if (Screen.safeArea.width < Screen.safeArea.height)
{
return DeviceOrientation.Portrait;
}
return DeviceOrientation.LandscapeLeft;
}
public static DeviceOrientation Get(float width, float height)
{
if (width < height)
{
return DeviceOrientation.Portrait;
}
return DeviceOrientation.LandscapeLeft;
}
}
}