Unity Udexreal开发插件包
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.

42 lines
1.1 KiB

using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
namespace UDE_HAND_INTERACTION
{
[CustomEditor(typeof(FingerPressInteractor))]
public class FingerPressInteractorEditor : EditorUtils
{
private SphereBoundsHandle _sphereHandle = new();
private FingerPressInteractor _interactor;
private SerializedProperty _pointProperty;
private void Awake()
{
_interactor = target as FingerPressInteractor;
_sphereHandle.SetColor(new Color(0f, 1f, 1f, 0.5f));
_sphereHandle.midpointHandleDrawFunction = null;
_pointProperty = serializedObject.FindProperty("TipTransform");
}
private void OnSceneGUI()
{
DrawSphereEditor();
}
private void DrawSphereEditor()
{
Transform transform = _pointProperty.objectReferenceValue as Transform;
if (transform == null)
{
return;
}
_sphereHandle.radius = _interactor.Radius;
_sphereHandle.center = transform.position;
_sphereHandle.DrawHandle();
}
}
}