public void OnSceneGUI() { DragTrack_Straight _target = (DragTrack_Straight)target; Handles.color = Color.white; Vector3 maxPosition = _target.transform.position + (_target.transform.up * _target.maxDistance); maxPosition = Handles.PositionHandle(maxPosition, Quaternion.identity); Handles.DrawSolidDisc(maxPosition, -_target.transform.up, _target.discSize); _target.maxDistance = Vector3.Dot(maxPosition - _target.transform.position, _target.transform.up); Handles.color = Color.grey; Vector3 minPosition = _target.transform.position; Handles.DrawSolidDisc(minPosition, _target.transform.up, _target.discSize); Handles.color = Color.white; Handles.DrawLine(minPosition, maxPosition); if (GUI.changed) { EditorUtility.SetDirty(_target); } }