neuecc / UniRx

Reactive Extensions for Unity
MIT License
7.01k stars 895 forks source link

'Subscribe' and 'Do' don't work in 'SceneManager.LoadSceneAsync(scene).AsAsyncOperationObservable()' #501

Open ORibn-dev opened 2 years ago

ORibn-dev commented 2 years ago

I'm trying to execute certain actions while loading the scene and after it's loaded, but everything inside Do and Subscribe is not executed. So it loades the scene, but there are no messages in Console or methods executed no matter what I try.

Example:

SceneManager.LoadSceneAsync(sceneIndex) .AsAsyncOperationObservable() .Do(x => { Debug.Log("progress: " + x.progress); }).Subscribe( => { Debug.Log("loaded"); }) .AddTo(this);

studentutu commented 2 years ago

@ORibn-dev I would go with a plain Unitask -> they have a better support and overall experience with Tasks, Task Asynchronous patterns.

ORibn-dev commented 2 years ago

@studentutu thank you, I'll give it a try.