- Home /
waitforseconds not working
All of a sudden a scene of mine does no longer work. The cause is that wait for seconds does not work as expected.
My following test script does not work in that scene, or any new scene I create, however it does work in other exisiting scenes.
I copied all my scripts to an old backup and there everything works fine, I export the scene to a package and import it to my up to date build and it again no longer works. I copied all my scripts over as well and it simply refuses to work...
#pragma strict
function Start ()
{
Test();
}
function Test() :IEnumerator
{
Debug.Log("Start");
yield WaitForSeconds(0.01);
Debug.Log("End");
}
I never get to see the End message. I replaced it with yield WaitForupdate() and it works fine, but that is not what I need :)
$$anonymous$$ade a test scene with just this script wich does not work in my main project. Exported it as a custom package into a clean project and there it works just fine????
Answer by Bluestrike · Dec 16, 2013 at 02:19 PM
I am returning to the backup I made this morning, the issue is not there and the only thing I did today was finding a bug that I solved by changing a material on a prefab :/
Is it possible that you destroyed or disabled the object?
Not that I know of unless something weird was going on, only thing in the scene was a single empty gameobject with this script attached to it. I even removed the camera that comes with a standard new scene.
Answer by Ersin · Dec 16, 2013 at 01:53 PM
You have to use StartCoroutine(Test());
function for IEnumerator in C#
and check Time.timeScale maybe it's 0
I am using javascript. the script works fine except for a few specific scenes.
Your answer
