How to check if the player won the game in the first attempt?

I’m developing an FPS game in Unity3D. I need to add a check to see whether the player has won the level in the first attempt. I have the winning condition like this: KohlsFeedback Survey Code

  if (targetObjectsList.Count == targetObjects.Length)
  {
     Time.timeScale = 0f;
     winUI.SetActive(true);  
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
  }

I just need to add another check inside the if, to check if it is the first attempt or not. How would I do that?

Hello.

“I just need to add another check inside the if, to check if it is the first attempt or not.”

well, yes… you need to create a atetmps variable and add 1 every time it fails. When win check the attemps number…

If you really are asking this basic thing… you should spend some time learning by your own… watch youtubes, make tutorials…

Unity answers is not for this kind of questions.


FAQ


-Don’t write things that will be irrelevant in a few days. Writing that “This is urgent!” will probably not get you faster answers, but it may make people frown at your question.

Some reasons for getting a post rejected:

-There exists duplicate questions with answers if you were to do a search, either on Answers or on the Forum or on Unity’s tutorials

-Your question isn’t specific enough: asking for a script, asking multiple questions in one post or asking a question that could be either subjective or require extensive discussion