private void ProcessCheckpoints() { //sort checkPoints.Sort((c1, c2) => c1.Index.CompareTo(c2.Index)); //validate int index = 0; foreach (var checkPoint in checkPoints) { if (checkPoint.Index != index) { Debug.LogError( "Checkpoints configured wrong. You have spaces between checkpoints indexes or duplicated indexes!"); return; } index++; } nextCheckpoint = 0; if (checkPoints.Count < 2) { Debug.LogError( "You have less then 2 checkpoints! Add more!"); return; } if (finish == null) { Debug.LogError("Finish not registred!"); } for (int i = 2; i < checkPoints.Count; i++) { checkPoints[i].Hide(); } checkPoints[0].ShowStraight(); cameraManager.AddTarget(checkPoints[0].transform); cameraManager.AddTarget(checkPoints[1].transform); finish.Hide(); }