// Code that runs on entering the state. public override void OnEnter() { GameObject go = Fsm.GetOwnerDefaultTarget(GameObject); if (go) { CurvySpline spl = go.GetComponent <CurvySpline>(); if (spl) { if (!Index.IsNone) { CurvySplineSegment seg = (Index.Value >= 0 && Index.Value < spl.ControlPointCount) ? spl.ControlPoints[Index.Value] : null; for (int i = 0; i < Points.Length; i++) { if (!Points[i].IsNone) { CurvySplineSegment newCP; if (Mode == InsertMode.After) { newCP = spl.InsertAfter(seg); } else { newCP = spl.InsertBefore(seg); } if (Space == Space.Self) { newCP.localPosition = Points[i].Value; } else { newCP.position = Points[i].Value; } } } spl.Refresh(); } } } Finish(); }