private void OnEnable() { if (ptrSplineLine != null) { //Debug.Log("sDPI: " + startingDestPointIndex + " -> " + ptrSplineLine.GetPreviousControlPointIndex(startingDestPointIndex)); currentPreviousSplinePoint = ptrSplineLine.GetPreviousControlPointIndex(startingDestPointIndex); } transform.GetComponent <NavMeshAgent>().speed = speed; }