I’ve started to play with UIToolkit for a new project. At some point, I realized, that Binding is not yet implemented for Runtime. To be able to use the feature eventually and to make the migration process as smooth as possible, I hacked together a simple binding implementation (supporting labels for now):
It’s probably very performant, but it works in my case, as the UI is not frequently updated.
I’m a bit baffled, because the code is so simple.
So I’m asking myself, if there is something obvious, that I can’t see with my limited Unity experience. Is this the way to go forward? Am I shooting myself in the foot with this approach somehow?
You’re not missing anything. What you have works for one-way bindings (like Labels). More complexity is needed if you want two-way bindings. Even more complexity is needed if you want to handle all types of data, not just string. And even more complexity is needed if you don’t want to manually track changes to UI fields and your data model, but have the binding system do that for you. We kinda want to solve all those problems for runtime, hence the delay. But we’re making good progress.