BloodAndGore/Assets/Scripts/Utils/CameraHelper.cs

22 lines
586 B
C#
Raw Normal View History

2019-08-07 20:03:51 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2019-08-14 16:17:48 +02:00
namespace Saltosion.OneWeapon.Utils {
2019-08-07 20:03:51 +02:00
public class CameraHelper : MonoBehaviour {
public Camera Camera;
[Range(1, 4)]
public int PixelScale = 2;
public int PixelsPerUnit = 32;
private int LastHeight = -1;
2019-08-07 20:03:51 +02:00
private void Update() {
if (LastHeight != Screen.height) {
Camera.orthographicSize = Screen.height * ((0.5f / PixelsPerUnit) / PixelScale);
LastHeight = Screen.height;
}
2019-08-07 20:03:51 +02:00
}
}
}