Question by
kyco4ekmyaska · Oct 08, 2017 at 06:40 AM ·
c#unity 5coroutinestopping
unity 5 stopping
Hello, when coroutine is launched,unity is stopping
IEnumerator Viewers_cor()
{
while (true)
{
if (Viewers <= 10)
{
Viewers += UnityEngine.Random.Range(0, 2);
yield return new WaitForSeconds(2.0f);
}
else if (Viewers >= 100)
{
Viewers += UnityEngine.Random.Range(0, 3);
yield return new WaitForSeconds(2.0f);
}
else if (Viewers >= 500)
{
Viewers += UnityEngine.Random.Range(0, 4);
yield return new WaitForSeconds(2.0f);
}
else if (Viewers >= 1500)
{
Viewers += UnityEngine.Random.Range(1, 5);
yield return new WaitForSeconds(2.0f);
}
else if (Viewers >= 5000)
{
Viewers += UnityEngine.Random.Range(2, 6);
yield return new WaitForSeconds(2.0f);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Coroutine and SetFloat not working as expected 0 Answers
Trying to move buttons via Coroutine and transform.Translate 0 Answers
display rotating animation while calculating operation that takes long time 0 Answers
Stop previous coroutine and start new one from beginning 1 Answer
Gameobject spinning by itself. 2 Answers