I have two classes:
class SubScreen extends MonoBehaviour
{
function Open()
{
SetShow( true );
RandomUtils.ToggleVisibility( gameObject );
}
}
and
class SubScreen_AdvGameOver extends SubScreen
{
override function Open()
{
super();
yield WaitForSeconds(1);
// looking to do some more stuff down here...
}
}
However, this causes a compiler error: BCE0101: Return type 'void' cannot be used on a generator. Did you mean 'IEnumerator'? You can also use 'System.Collections.IEnumerable' or 'object'.
I have used yield WaitForSeconds() in numerous other places and it has worked fine. I've looked up to see if anyone else has had problems, and I found things like calling the function from Update() and OnGUI() -- The Open() function is not called from either of those. I can declare other functions in the child class that are allowed to have a yield in them, and the compiler does not throw any errors.
Under what circumstances can you yield in a function?
Hi Joe, I think I have a similar problem: [link text][1]. I have added the return type EInumerator to my functions but then the coroutine is never executed... [1]: http://answers.unity3d.com/questions/566495/fsm-and-coroutine-problem.html
– Zaqnafein