-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best practice for global singleton ViewMode? #2
Comments
Could you please give out more information on the usecase? |
https://dev.epicgames.com/documentation/en-us/unreal-engine/umg-viewmodel#globalviewmodelcollection |
In the game, there are many global ViewModels, such as account data, current level data, tasks, and so on. For these global ViewModels, it would be much more convenient if they could be directly referenced when binding data in the UI, without the need to manually install the ViewModel through code. |
Truthfully the current implementation only supports binding through setting up components on GameObject beforehand. Binding through code has not been supported very well; many autormated mechanism is currently missing. I'm afraid it might take a while before I can work on these missing pieces. |
Can we refer to UE5 MVVM and add a global binding context option in the binding context? |
Feel free to fork this repo and experiment however you please. Btw, if I might have a word of caution, a global strategy should be designed carefully and fully decoupled from the core functionality. Especially singletons should only be an extension to the core. |
@grashaar Do you have any evaluation of this simple implementation |
I really don't like the idea of coupling MonoBindingContext with detailed implementation on how to get the ObservableObject reference. The global object should be injected into MonoBindingContext via a different component. |
The main purpose is to reduce the number of operational steps. If it is an independent component, it is necessary to synchronize some settings to MonoBindContext to ensure that MonoBinder can display relevant information normally in the future I expect that in most cases in my project, it will be GlobalObject, which will result in the need for many additional GlobalObject components |
I think what is missing from the current MonoBindingContext is the ability to provide any type information for the binders. Type information should be decoupled from runtime instances of ObservableObject. |
Indeed, I think it's even possible to consider selecting the target VM type and target property path directly on each attribute of the binder. The multiple VM instances required by the binder are installed at runtime by external features such as MonoBindContext, Enhanced GridBinding, or GlobalObject Components |
Then we need a powerful editor toolset to govern the target types and its property paths so we can notify the user if any type is missing or some property paths no longer exist. Because the target types will be scattered everywhere across the View prefab. |
Consider directly based on Odin, which makes it easier to scale and reduces workload. I don't think anyone wouldn't need Odin🤔 |
Odin is a paid software, it can't be a dependency for an open source library such as this. On the other hand, I don't think Odin can help much instead of providing premade utitlities to work with types. |
No description provided.
The text was updated successfully, but these errors were encountered: