Page 1 of 1

Data binding through interface

Posted: 29 Oct 2013, 01:14
by JmD
Are there any plans for making data binding possible by any other way than inheriting from BaseComponent?
For example by implementing an interface (in the same way as INotifyPropertyChanged)?
The need to inherit from BaseComponent really limits the flexibility of how to construct the classes to bind to.

Aside from the above I find your GUI-plugin to be really excellent so far. Congrats on an impressive technique.

///JmD

Re: Data binding through interface

Posted: 29 Oct 2013, 12:00
by sfernandez
Hi JmD,

Could you please explain which are the limitations you are facing by the necessity of inheriting from BaseComponent?

Maybe we can find a way to solve these limitations.

P.S. Thanks for the nice words :)

Re: Data binding through interface

Posted: 30 Oct 2013, 08:03
by JmD
Hello sfernandez,

Thank you for your quick reply. It is always impressive to see such commitment to the users from the developer.

One limiting factor is that my classes need to inherit from MonoBehaviour. I could "break out" all the properties from my classes that I want to data bind to, and put them in separate classes that inherits from BaseComponent. Then I could use composition and "put them back in" again. But that means I need to restructure my complete framework which is something I would like to avoid if possible. But maybe that is the way I need to go?

///JmD

Re: Data binding through interface

Posted: 30 Oct 2013, 11:29
by jsantos
yes, for now the best approach is using composition. In fact, at first, I would say that even the code is better this way because you separate different concepts (unity script, data binding) in different classes. Could you please post a sample of those behaviours you have that need to be the source of binding?

Anyway, we have to think more about this because this is a deviation from WPF, thing we try to avoid Whenever possible.