BoxProximityFieldEditor.cs 915 B

123456789101112131415161718192021222324252627282930313233
  1. using UnityEditor;
  2. using UnityEngine;
  3. using Rokid.UXR.Interaction;
  4. namespace Rokid.UXR.Editor
  5. {
  6. [CustomEditor(typeof(BoxProximityField))]
  7. public class BoxProximityFieldEditor : UnityEditor.Editor
  8. {
  9. private SerializedProperty _boxTransformProperty;
  10. private void Awake()
  11. {
  12. _boxTransformProperty = serializedObject.FindProperty("_boxTransform");
  13. }
  14. public void OnSceneGUI()
  15. {
  16. Debug.Log("Draw OnSceneGUI");
  17. Handles.color = EditorConstants.PRIMARY_COLOR;
  18. Transform boxTransform = _boxTransformProperty.objectReferenceValue as Transform;
  19. if (boxTransform != null)
  20. {
  21. using (new Handles.DrawingScope(boxTransform.localToWorldMatrix))
  22. {
  23. Handles.DrawWireCube(Vector3.zero, Vector3.one);
  24. }
  25. }
  26. }
  27. }
  28. }