PlaneGizmosInScene.cs 733 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using UnityEngine;
  3. public class PlaneGizmosInScene : MonoBehaviour
  4. {
  5. private void OnDrawGizmos()
  6. {
  7. if (string.IsNullOrEmpty(this.property))
  8. {
  9. this.property = base.name;
  10. }
  11. if (!this._show)
  12. {
  13. return;
  14. }
  15. this._color.a = this._alpha;
  16. Gizmos.color = this._color;
  17. Gizmos.DrawCube(base.transform.position, this._size);
  18. DebugX.DrawText(this.property, base.transform.position);
  19. }
  20. [SerializeField]
  21. private bool _show = true;
  22. [SerializeField]
  23. private string property;
  24. [SerializeField]
  25. private Vector2 _size = new Vector2(20f, 10f);
  26. [SerializeField]
  27. private Color _color = Color.cyan;
  28. [Range(0f, 1f)]
  29. [SerializeField]
  30. private float _alpha = 0.2f;
  31. }