Real-Serious-Games / Unity-Weld

MVVM-style data-binding system for Unity.
MIT License
498 stars 80 forks source link

How to properly bind to ViewModel data that is avaialbe after Awake? #38

Open robertverdes opened 4 years ago

robertverdes commented 4 years ago

This seems like a a great library, and I might be severely missing the point, but I don't see a way out of the box to support binding to ViewModels that have their data populated after Awake (since initializiation for binders seems to happen on Awake). e.g.

Adding [DefaultExecutionOrder(100)] to AbstractMemeberBinding fixes it for VMs already in the scene at lauch, but it doesn't work for those created at runtime.

Any insights welcome! Thanks!

robertverdes commented 4 years ago

Ok, modifying AbstractMemberBinding to call Init() in "Start" rather than "Awake" seems to do the trick. Are there any pitfalls to this change in the context of the library?