DecalGizmos.cs 938 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using System.Collections;
  4. using UnityEditor;
  5. namespace LuxURPEssentials
  6. {
  7. public static class DecalGizmos {
  8. static void DrawGizmo(GameObject go, GizmoType type, float dtype) {
  9. bool selected = (type & GizmoType.Selected) > 0;
  10. if (selected) {
  11. Gizmos.DrawRay(go.transform.position, -go.transform.up);
  12. }
  13. var col = new Color(dtype, 0.7f, 1f, 1.0f);
  14. col.a = selected ? 0.4f : 0.2f;
  15. Gizmos.color = col;
  16. Gizmos.matrix = go.transform.localToWorldMatrix;
  17. Gizmos.DrawCube(Vector3.zero, Vector3.one);
  18. col.a = selected ? 0.5f : 0.1f;
  19. Gizmos.color = col;
  20. Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
  21. }
  22. [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Selected | GizmoType.Pickable)]
  23. static void DrawGizmo(Decal decal, GizmoType type ) {
  24. if (DecalManager.DrawDecalGizmos) {
  25. DrawGizmo(decal.gameObject, type, 0.0f );
  26. }
  27. }
  28. }
  29. }
  30. #endif