using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [ExecuteInEditMode] public class BGUICheck : MonoBehaviour { // Update is called once per frame void Update() { float bl2 = (float)Screen.height / this.GetComponent().texture.height; this.GetComponent().sizeDelta = new Vector2(this.GetComponent().texture.width, this.GetComponent().texture.height); this.transform.localScale = new Vector3(bl2, bl2, bl2); } }