Skip to main content

Debug Binder

A binder for debugging bindings.


DebugLogBinder​

A universal binder that logs every operation to Debug.Log. Implements IAnyBinder and IAnyReverseBinder, so it accepts any data type.

What it logs​

EventMessage
SetValue(value)SetValue: {converted}
ValueChanged subscribedAdd ValueChanged: {callback}
ValueChanged unsubscribedRemove ValueChanged: {callback}

Inspector properties​

PropertyDescription
_converterIConverter<object, string> used for display (default ObjectToStringConverter)

Modes: all (OneWay, TwoWay, OneTime, OneWayToSource).

Usage​

Add DebugLogMonoBinder to any MonoView and bind it to the ViewModel property in the Inspector. Every change of the property is logged to the Console.

// Or from code:
var debugBinder = new DebugLogBinder();
view.BindCustomBinder("PlayerName", debugBinder);
// Console: "SetValue: John"

When to use​

  • Check that a binding works and values arrive
  • Debug the order of SetValue calls
  • Make sure reverse binding subscribes correctly

See also​