StationObscurum/Assets/Packages/Heat - Complete Modern UI/Scripts/UI Elements/CanvasManager.cs

18 lines
521 B
C#
Raw Normal View History

2024-02-02 04:45:59 +01:00
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);
}
}
}