In the example below, how can I get FinishFirst() to complete first before running DoLast(), while still retaining the 'public void StartPage()' signature?
I'm trying to avoid making "StartPage()" return an IEnumerator as that would force me to change it in the interface. It would be great if my Interface for StartPage() supported both IEnumerator and Void without needing to implement both.
public void StartPage()
{
print("in StartPage()");
StartCoroutine(FinishFirst(5.0f));
DoLast();
print("done");
}
IEnumerator FinishFirst(float waitTime)
{
print("in FinishFirst");
yield return WaitForSeconds(waitTime);
print("leave FinishFirst");
}
void DoLast()
{
print("do after everything is finished");
}
↧