checkSize.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class checkSize : MonoBehaviour
  6. {
  7. public int lg = 1;
  8. // Update is called once per frame
  9. void Update()
  10. {
  11. int w =750;
  12. if(GetTexture2D.urlbase.Contains("329"))
  13. {
  14. this.GetComponent<RectTransform>().sizeDelta = new Vector2(this.GetComponentsInChildren<RawImage>().Length*w/ lg, 450);
  15. if(w*6>(this.GetComponentsInChildren<RawImage>().Length*w/ lg))
  16. {
  17. this.GetComponent<RectTransform>().sizeDelta = new Vector2(w*6, 450);
  18. }
  19. else
  20. {
  21. }
  22. }
  23. else
  24. {
  25. if(700*6>(this.GetComponentsInChildren<RawImage>().Length*w/ lg))
  26. {
  27. this.GetComponent<RectTransform>().sizeDelta = new Vector2(w*6, 900);
  28. }
  29. else
  30. {
  31. this.GetComponent<RectTransform>().sizeDelta = new Vector2(this.GetComponentsInChildren<RawImage>().Length*w/ lg, 900);
  32. }
  33. }
  34. }
  35. }