- Home /
Question by
hamid.rdt · Jun 14, 2015 at 01:54 PM ·
yieldunity 4.6yield waitforseconds
yeild not work my unity 4.6 but on unity 5 or other version working correctly!!!!!!!
Hello my freinds
on this code , yeild not work in my unity 4.6 but on unity 5 or other version working correctly!!!!!!!
using UnityEngine; using System.Collections;
public class PreloadSceneProgressBar : MonoBehaviour { void Update() {
if(Input.GetButtonDown("Fire")){
print ("Fire");
StartCoroutine(OutOfAmmo());
}
}
IEnumerator OutOfAmmo()
{
yield return new WaitForSeconds(3);
print ("Test");
}
}
after yield commond not work! (on unity 5 or other version working correctly)!
please help me
Comment
What does it do? Are you saying it prints Fire, but then prints Test right away? Or it never prints Test?
Answer by Xarbrough · Jun 14, 2015 at 11:38 PM
If you're not getting any error messages, it could be that your TimeScale is set to zero. Do another print statement right before the yield and see if the Coroutine gets started. If so, it might be that you've set TimeScale somewhere else (pausing game etc...).