FM/Assets/Art/FUJIFILM/Scripts/InitScreen.cs

29 lines
666 B
C#

using UnityEngine;
namespace FUJIFILM
{
public class InitScreen : MonoBehaviour
{
private void Awake()
{
AdjustScreenResolution();
}
private void AdjustScreenResolution()
{
float w = Screen.currentResolution.width;
float h = Screen.currentResolution.height;
if (w * 16 > h * 9)
{
Screen.SetResolution((int)(h * (float)((float)9 / 16)), (int)h, true);
}
else
{
Screen.SetResolution((int)w, (int)(w * (float)((float)16 / 9)), true);
}
//#endif
}
}
}