private void DrawSelectedPointInspector() { GUILayout.Label("Current Point"); EditorGUI.BeginChangeCheck(); Vector3 point = EditorGUILayout.Vector3Field("Position", mgcurves.GetControlPoint(selectedIndex)); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(mgcurves, "Move Point"); EditorUtility.SetDirty(mgcurves); mgcurves.SetControlPoint(selectedIndex, point); } }
void Awake() { controlPoints = new Vector3[mgCurve.ControlPointCount]; if (reversed) { for (int i = 0; i < mgCurve.ControlPointCount; i++) { controlPoints[i] = mgCurve.GetControlPoint(i); } } else { for (int i = 0; i < mgCurve.ControlPointCount; i++) { controlPoints[i] = mgCurve.GetControlPoint(mgCurve.ControlPointCount - 1 - i); } } controlPoints = mgCurve.Resolve(controlPoints, 100); // get our lengths GetLengths(); totalDistance = lengths[lengths.Length - 1]; }