neuecc / UniRx

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

[Pull request] Animation.PlayAsObservable #445

Open MartinGonzalez opened 4 years ago

MartinGonzalez commented 4 years ago

I've created an extension method for the legacy Animation clips when you hit Play. Under the hood it creates an AniamtionEvent at the end of the AnimationClip.

Do you think this is useful to create a pull request?

What are your thoughts?

Example code:

  animation
            .PlayAsObservable("Anim01")
            .SelectMany(_ => animation.PlayAsObservable("Anim02"))
            .SelectMany(_ => animation.PlayAsObservable("Anim03"))
            .SelectMany(_ => animation.PlayAsObservable("Anim04"))
            .Subscribe();

demo_playasobservable mov