private void ShowPoint(int index, Vector3 point) { if (!CanShowPoint(index)) { return; } Handles.color = ModeColors[(int)m_splineBase.GetControlPointMode(index)]; if (index % 3 == 0) { Handles.color = Color.green; } float size = HandleUtility.GetHandleSize(point); Handles.CapFunction dcf = Handles.DotHandleCap; if (index == 0) { size *= 2f; } if (Handles.Button(point, m_handleRotation, size * HandleSize, size * PickSize, dcf)) { m_selectedIndex = index; SplineControlPoint controlPoint = m_splineBase.GetComponentsInChildren <SplineControlPoint>(true).Where(cpt => cpt.Index == index).FirstOrDefault(); if (controlPoint != null) { if (Event.current.control || Event.current.shift) { GameObject[] objects = Selection.gameObjects; Selection.activeGameObject = controlPoint.gameObject; if (!objects.Contains(controlPoint.gameObject)) { ArrayUtility.Add(ref objects, controlPoint.gameObject); } else { if (!Event.current.shift) { ArrayUtility.Remove(ref objects, controlPoint.gameObject); } } Selection.objects = objects; } else { Selection.activeGameObject = controlPoint.gameObject; } } Repaint(); } if (m_selectedIndex == index) { int curveIndex = (m_selectedIndex - 1) / 3; int prevCurveIndex = curveIndex - 1; int nextCurveIndex = curveIndex + 1; if (m_splineBase.Loop) { if (prevCurveIndex < 0) { prevCurveIndex = m_splineBase.CurveCount - 1; } if (nextCurveIndex > m_splineBase.CurveCount - 1) { nextCurveIndex = 0; } } GUIStyle style = new GUIStyle(); style.normal.textColor = Color.green; if (prevCurveIndex >= 0) { float prevLen = m_splineBase.EvalLength(prevCurveIndex); float prevCur = m_splineBase.EvalCurveLength(prevCurveIndex, GetStepsPerCurve()); Handles.Label(m_splineBase.GetPoint(0.5f, prevCurveIndex), string.Format("Len: {0:0.00} m, Cur: {1:0.00} m", prevLen, prevCur), style); } if (nextCurveIndex < m_splineBase.CurveCount) { float nextLen = m_splineBase.EvalLength(nextCurveIndex); float nextCur = m_splineBase.EvalCurveLength(nextCurveIndex, GetStepsPerCurve()); Handles.Label(m_splineBase.GetPoint(0.5f, nextCurveIndex), string.Format("Len: {0:0.00} m, Cur: {1:0.00} m", nextLen, nextCur), style); } float cur = m_splineBase.EvalCurveLength(curveIndex, GetStepsPerCurve()); float len = m_splineBase.EvalLength(curveIndex); Handles.Label(m_splineBase.GetPoint(0.5f, curveIndex), string.Format("Len: {0:0.00} m, Cur: {1:0.00} m", len, cur), style); } }