using UnityEngine; namespace UnityEditor { /// /// LightAnchorHandles describes the Handles for the LightAnchorEditorTool /// public class LightAnchorHandles { /// /// The light position /// public Vector3 lightPosition { get; set; } /// /// The anchor position /// public Vector3 anchorPosition { get; set; } LightAnchor target; /// /// Initializes and returns an instance of LightAnchorHandles /// /// Target object public LightAnchorHandles(LightAnchor target) { this.target = target; } /// /// On GUI /// public void OnGUI() { Handles.color = Color.yellow; Handles.DrawDottedLine(lightPosition, anchorPosition, 2f); // Orient the handle rotation depending on the editor pivot rotation mode var handleRotation = Quaternion.identity; if (Tools.pivotRotation == PivotRotation.Local && target != null) handleRotation = target.transform.rotation; anchorPosition = Handles.PositionHandle(anchorPosition, handleRotation); } } }