StationObscurum/Assets/Packages/Heat - Complete Modern UI/Scripts/UI Elements/CanvasManager.cs
2024-02-01 22:45:59 -05:00

18 lines
521 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Heat
{
[RequireComponent(typeof(Canvas))]
[RequireComponent(typeof(CanvasScaler))]
public class CanvasManager : MonoBehaviour
{
CanvasScaler canvasScaler;
public void SetScale(int scale = 1080)
{
if (canvasScaler == null) { canvasScaler = gameObject.GetComponent<CanvasScaler>(); }
canvasScaler.referenceResolution = new Vector2(canvasScaler.referenceResolution.x, scale);
}
}
}