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

Unity Freeze when im using while timer

$
0
0
Hello. When i try run this script it freezes unity. I read about this problem it is problem when while loop is infinite but in my case it isnt. I use this code in update function. Thanks for answers :) Code Here: for (int i = 0; i < max; i++){ while (wait > 0) { Debug.Log("-"); wait -= Time.deltaTime;//decressing timer } food.GetComponent().color = Color.gray; //set color food.transform.position = Random.insideUnitCircle + new Vector2(transform.position.x, transform.position.y); //set positions Instantiate(food); //create gameobject count++; wait = 100; //setting it back up }

Viewing all articles
Browse latest Browse all 2383

Trending Articles



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