Try to make usage of a binding in a DataBindingOperator easier

Issue #27 resolved
Christian Oeing repo owner created an issue

Right now there are 4 steps:

  • AddBinding in Awake
  • RemoveBinding in OnDestroy
  • Add listener and initialization in OnEnable
  • Remove listener in OnDisable

Some ideas for improvements:

  • The logic in RemoveBinding could be done automatically on destruction.
  • There should be an overload for AddBinding which takes a delegate which is called when the binding changed and on initialization.
  • There might be a virtual method (AddBindings) that is called by the base class in Awake() instead of expecting the dev to remember that AddBinding calls have to be put in Awake()

Comments (8)

  1. Christian Oeing reporter

    Having AddBinding to be called in Init() method is okay. There are enough examples that do it and once you know where to add bindings, it's clear. So there is no need for a special AddBindings() method.

  2. Christian Oeing reporter

    Added overload for AddBinding to provide an additional callback that should be invoked when the data binding value changed.

  3. Log in to comment