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
}
↧