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

Level genration loop crashing unity3D

$
0
0
I have an editor script that generates a random level, I have a for loop that checks for duplicates of certain objects and is supposed to reset and check if it finds one but it keeps crashing and freezing unity. What is wrong with my loop? private int CheckForMultiple(int testBuilding, int roomIndex) { int newBuilding = testBuilding; for(int i = 1; i < roomIndex; i++) { if(_indexes[i] == newBuilding) { newBuilding = (int)Random.Range(0, backgroundElements.Count); i = 1;//reset loop and start over } } return newBuilding; }

Viewing all articles
Browse latest Browse all 2383

Trending Articles



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