BloodAndGore/Assets/Scripts/Utils/CameraHelper.cs

22 lines
586 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon.Utils {
public class CameraHelper : MonoBehaviour {
public Camera Camera;
[Range(1, 4)]
public int PixelScale = 2;
public int PixelsPerUnit = 32;
private int LastHeight = -1;
private void Update() {
if (LastHeight != Screen.height) {
Camera.orthographicSize = Screen.height * ((0.5f / PixelsPerUnit) / PixelScale);
LastHeight = Screen.height;
}
}
}
}