Quantcast
Channel: Questions in topic: "crash"
Viewing all articles
Browse latest Browse all 2383

unity crashes when i run a empty foreach loop

$
0
0
ignore the 50 nested lists, all the code does is make 25 sets of 3 pairs of coordinates I don't want any of the 3 pairs to be the same. The List<>.Contains doesn't work for nested lists for some reason. The foreach that I want to use to check if the pair already exists instantly crashes unity when run. List>> randomizedroomsections = new List>>(); for (int a = 0; a < 5; a++) { for (int b = 0; b < 5; b++) { List> randomposes = new List>(); while (randomposes.Count < 3) { List randompos = new List(); randompos.Add(Random.Range(0, 3)); randompos.Add(Random.Range(0, 3)); //the for each below doesn't work foreach (List randompos1 in randomposes) { //if (!(randompos1 == randompos)) //{ //randomposes.Add(randompos); //} } } randomizedroomsections.Add(randomposes); } } String f = "Randomized:"; foreach (List> thing1 in randomizedroomsections) { f = f + "\n"; foreach (List thing2 in thing1) { f = f + "\n"; foreach (int thing3 in thing2) { f = f + thing3 + ", "; } } }

Viewing all articles
Browse latest Browse all 2383

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>