WidthCheckerFixer.cs 321 B

12345678910111213141516
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class WidthCheckerFixer : MonoBehaviour
  5. {
  6. public float requredWidth = 100;
  7. public RectTransform rectTransform;
  8. private void OnEnable()
  9. {
  10. if(rectTransform.GetWidth() <= 0)
  11. {
  12. rectTransform.SetWidth(requredWidth);
  13. }
  14. }
  15. }