C#C
C#14mo ago
4 replies
Pokruk

✅ Syntax sugar for coroutines

Why can I do this
IEnumerator WaitForSomehting() {
    yield return resp.WaitResult();
    Debug.Log("Wrapper res" + resp.result);
    Debug.Log("Wrapper error" + resp.error);
}
SomeMonoBehaviour.Instance.StartCoroutine(WaitForSomehting);

But not this?
SomeMonoBehaviour.Instance.StartCoroutine(() => {
    yield return resp.WaitResult();
    Debug.Log("Wrapper res" + resp.result);
    Debug.Log("Wrapper error" + resp.error);
});
image.png
Was this page helpful?