You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
when the ViewModel is created at runtime, and then initialized (since Unity doesn't allow initializing a GameObject before Awake except if it's disabled, and that's an ugly flow for prefabs)
or even, using IViewModelProvider to have POCO VMs, as you suggested in previous issue replies: how can GetViewModel return a valid non-MonoBehaviour instance that's somehow injected into the MonoBehaviour (ony way I see is you'd have to call some static singleton-ish provider class from within the method for it to happen before Awake, and I'd like to be able to stick with a DI flow)
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!
The text was updated successfully, but these errors were encountered:
robertverdes
changed the title
How to properly bind to (View)Models data that is avaialbe after Awake?
How to properly bind to ViewModel data that is avaialbe after Awake?
Dec 3, 2019
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?
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!
The text was updated successfully, but these errors were encountered: