- Home /
Yield aint working in C# code.
Hi, i have a JS script amd im converting it to C# but the yield part aint working. Any sugestions to this code?
void Start() { if (secondsDelayStart > 0) { started = false; new WaitForSeconds(secondsDelayStart); }
started = true;
startRunning = Time.timeSinceLevelLoad;
}
Comment
Answer by DaveA · Apr 19, 2011 at 07:48 PM
I suggest read this: http://unity3d.com/support/documentation/ScriptReference/Coroutine.html
I changed the code to this:
void Start() {
if (secondsDelayStart > 0) {
started = false;
StartCoroutine(YieldWait());
}
started = true;
startRunning = Time.timeSinceLevelLoad;
}
public IEnumerator YieldWait() { yield return new WaitForSeconds(secondsDelayStart); }
and still doesnt work
Your answer
![](https://koobas.hobune.stream/wayback/20220613123852im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cloud recognition in Vuforia 0 Answers
Why is yield not working for me? 2 Answers
Why does this not work? 1 Answer
C# Wait for Coroutine 3 Answers