UniTask icon indicating copy to clipboard operation
UniTask copied to clipboard

Update ToCoroutineEnumerator<T> to return a T? from Current instead of object

Open TheCrossBoy opened this issue 9 months ago • 2 comments

ToCoroutine<T>() provides an excellent way to port existing synchronous calls to asynchronous without needing to fully rewrite everything - when inside a coroutine, it can be yielded instead.

To get the value that the previously-synchronous function would have returned, you use .Current. Right now, Current is an object, when it should be a T. I think this might have been to avoid problems with non-nullable / reference types, so I wrapped it in Nullable (with T?).

Eliminates extra unnecessary typecasting with this.

TheCrossBoy avatar Apr 17 '25 22:04 TheCrossBoy

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 15 '25 00:10 github-actions[bot]

not sure if feature development is ended in the repo, but bumping to remove stale tag as this would be nice

TheCrossBoy avatar Oct 16 '25 19:10 TheCrossBoy