push-pop / Unity-MVVM

Lightweight MVVM Framework for Unity3D
MIT License
323 stars 27 forks source link

Coroutine can't start if view is not active, making nested activators problematic #48

Closed push-pop closed 3 years ago

push-pop commented 3 years ago

This happens when you have a heirarchy like:

View (VisibilityBinding)

Because Unity can't run coroutines on objects that aren't active.

A few thoughts how this could be fixed: 1) Store the StartCoroutine call as an action and call it OnEnable 2) Create a dummy gameobject which runs the coroutine and provides a callback to set the alpha value) 3) Create basic tweening library for fading in/out (like leantween) that isn't reliant on gameobject