Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Consume enumerators for types inheriting AsyncOperation. #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dogramacigokhan
Copy link

@dogramacigokhan dogramacigokhan commented Jun 19, 2022

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
Copy link

qipa commented Jun 19, 2022 via email

zudl added a commit to zudl/UniRx that referenced this pull request Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants