After the first run of the script (that is, after the sheet is cleared), I get ArgumentOutOfRange In the line newAchiveNumber = achiveList [currentAchive]; I sincerely do not understand why - the situation is completely equivalent and, in theory, the script should not be executed at all (after all, after the idea. List.Clear () List.Count should be = 0, but for some reason it is not reset even if I do List = null
void WaitLine() { if (achiveList!=null&& achiveList.Count !=0 && noOneInWaitLine == false) { Debug.Log(achiveList.Count); newAchiveNumber = achiveList[currentAchive]; if (showFinished == true) { if (curTime == 0) { curTime = Time.time; // Pause over the Waypoint } if ((Time.time - curTime) >= 3f && achiveList.Count != currentAchive) { currentAchive++; curTime = 0; Debug.Log("Timer Finished"); showFinished = false; } } else { ShowAchiv(newAchiveNumber); showFinished = true; if (currentAchive == achiveList.Count) { achiveList.Clear(); currentAchive = 0; noOneInWaitLine = true; } } } }