源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 regels
830 B

1 maand geleden
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class DebugUILine : MonoBehaviour
  5. {
  6. #if UNITY_EDITOR
  7. static Vector3[] fourCorners = new Vector3[4];
  8. public bool is_enable = true;
  9. void OnDrawGizmos()
  10. {
  11. if (is_enable)
  12. {
  13. foreach (MaskableGraphic g in GameObject.FindObjectsOfType<MaskableGraphic>())
  14. {
  15. if (g.raycastTarget)
  16. {
  17. RectTransform rectTransform = g.transform as RectTransform;
  18. rectTransform.GetWorldCorners(fourCorners);
  19. Gizmos.color = Color.blue;
  20. for (int i = 0; i < 4; i++)
  21. Gizmos.DrawLine(fourCorners[i], fourCorners[(i + 1) % 4]);
  22. }
  23. }
  24. }
  25. }
  26. #endif
  27. }