neuecc / UniRx

Reactive Extensions for Unity
MIT License
7.08k stars 891 forks source link

Consume enumerators for types inheriting AsyncOperation. #516

Open dogramacigokhan opened 2 years ago

dogramacigokhan commented 2 years ago

Problem

Enumerators for the types inheriting AsyncOperation are not consumed as expected. All AsyncOperations have isDone property that needs to be checked before completing the enumeration. This is done correctly for the base type by using the Unwrap... method, but the types inheriting it are handled as an unkown case.

Example

Without this fix, when a webrequest is performed in Edit-mode using UnityWebRequest.Get() and AsAsyncOperationObservable extension, the observable publishes a value immediately without waiting request to complete.

Solution

Changed comparison to handle all types assignable to the AsyncOperation base class, so the completion is waited for them before publishing a value.

qipa commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在忙碌中,无法亲自回复您的邮件,之后将尽快给您回复。