UIBG.cs 590 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UIBG : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. void Start()
  8. {
  9. }
  10. // Update is called once per frame
  11. void Update()
  12. {
  13. float bl = (float)Screen.width / 5760f;
  14. float bl2 = (float)Screen.height / 1620f;
  15. if(bl>bl2)
  16. {
  17. this.transform.localScale = new Vector3(bl2,bl2,bl2);
  18. }else
  19. {
  20. this.transform.localScale = new Vector3(bl, bl, bl);
  21. }
  22. }
  23. }