SpatialPanelInspector.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace EZXR.Glass.UI
  6. {
  7. [CustomEditor(typeof(SpatialPanel))]
  8. [CanEditMultipleObjects]
  9. public class SpatialPanelInspector : SpatialUIElementInspector
  10. {
  11. SpatialPanel _target_SpatialPanel;
  12. protected override void OnEnable()
  13. {
  14. base.OnEnable();
  15. _target_SpatialPanel = target as SpatialPanel;
  16. }
  17. public override void OnInspectorGUI()
  18. {
  19. base.OnInspectorGUI();
  20. serializedObject.Update();
  21. serializedObject.ApplyModifiedProperties();
  22. SceneView.RepaintAll();
  23. }
  24. public void OnSceneGUI()
  25. {
  26. Quaternion rotation = _target_SpatialPanel.transform.rotation;
  27. Matrix4x4 matrix = Matrix4x4.TRS(_target_SpatialPanel.transform.position, rotation, Vector3.one);
  28. Handles.matrix = matrix;
  29. Handles.DrawWireCube(Vector3.zero, _target_SpatialPanel.size);
  30. }
  31. }
  32. }