Closed sekkit closed 5 years ago
Yes, but with caveats. You can certainly expose MonoBehaviour.StartCoroutine
, call it with an IEnumerator
, and use its returned Coroutine
. You can even create your own base class implementing IEnumerator
in the same way you create a MonoBehaviour
derivative. That class' Current
and MoveNext
can be written in C++ just like how you'd write MonoBehaviour
message handlers like Start
or OnDestroy
in C++. However, that's not as natural a way to write a coroutine as you'd usually do in C#. That's because there's currently no support for iterator functions (i.e. those that yield
) in the bindings or in C++ itself. This may change if coroutines make it into C++20.
As the title indicates, is it possible to enable coroutine in c++.