thewar_client/Client/Assets/1_Script/System/CanvasSet.cs

25 lines
700 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CanvasSet : MonoBehaviour
{
private void Awake()
{
gameObject.GetComponent<CanvasScaler>().uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
gameObject.GetComponent<CanvasScaler>().referenceResolution = new Vector2(GameManager.Instance.x, GameManager.Instance.y);
}
void Start()
{
if(GameManager.Instance.Over)
{
gameObject.GetComponent<CanvasScaler>().matchWidthOrHeight = 1.0f;
}
else
{
gameObject.GetComponent<CanvasScaler>().matchWidthOrHeight = 0.0f;
}
}
}