private void Update() { timer += Time.deltaTime; if (timer - startTime > 5) { pointTransforms = new List <Vector3>(); curve = new List <Vector3>(); pointTransforms.Add(bezPoint1.transform.position); pointTransforms.Add(bezPoint2.transform.position); pointTransforms.Add(bezPoint3.transform.position); pointTransforms.Add(bezPoint4.transform.position); curve = Bezier.GenerateBezier(pointTransforms, 10); if (curve.Count > 0) { lineRenderer.positionCount = curve.Count; for (int i = 0; i < curve.Count; i++) { lineRenderer.SetPosition(i, curve[i]); } } } if (bezObjectMove != null && timer - startTime > 6 && coroutineStart == false) { curveLength = Bezier.CalculateCurveLength(curve); print(curveLength); curveSegments = Bezier.CalculateCurveSegments(curve); coroutineStart = true; } if (bezObjectMove != null && coroutineStart && timer - startTime > 7) { bezTravel(); } }