Question by
Lhixan · Feb 10, 2017 at 07:19 PM ·
c#scene-loadinglistscondition
How do I load a scene when my List is empty?
void Start()
{
unansweredQuestions = questions.ToList<Questions>();
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
SceneManager.LoadScene(0);
}
}
I have this Code where I reload the scene every time I click a button, and it takes one random thing from the List, but after it's taken all of them out of the list, it fills it up again with this piece of code, How do I make it so, that when I start the scene, it fills up the list once, and then loads scene (0)?
Something like this but I'm not sure what condition to put on the unansweredQuestions = questions.ToList();
unansweredQuestions = questions.ToList<Questions>();
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
SceneManager.LoadScene(0);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612110753im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
item not adding to list correctly! 1 Answer
Passing Score from Game Scene to Game Over Scene usiing dontDestroyOnLoad C# 1 Answer
How do I pull variables from an object in a list? 1 Answer
Using foreach to remove and delete bullet in List - C# 3 Answers
Is There A Way To Make If Statement Condition Shorter 3 Answers