Skip to main content

Canvas Group Binders

Binders for the CanvasGroup component.


CanvasGroupAlphaBinder

Binds the opacity, CanvasGroup.alpha.

InterfaceDescription
IBinder<float>Sets alpha
INumberBinderAccepts int, float, long, double

The value is clamped: Mathf.Clamp01(value).

Inspector properties

PropertyDescription
ConverterIConverter<float, float> (optional)

Modes: OneWay, OneTime, OneWayToSource (TwoWay is not allowed).

[ViewModel]
public partial class FadeViewModel
{
[OneWayBind] private float _panelAlpha; // 0.0 - 1.0
}

CanvasGroupAlphaSwitcherBinder

bool → one of two alpha values.

// Inspector: trueValue = 1.0, falseValue = 0.0
// Like show/hide, but with smooth control

Modes: OneWay, OneTime.


CanvasGroupInteractableBinder

Binds CanvasGroup.interactable.

InterfaceDescription
IBinder<bool>Sets interactable

Inspector properties

PropertyDescription
_converterOptional value converter (for example BoolInvertConverter)

Modes: OneWay, OneTime, OneWayToSource (TwoWay is not allowed).


CanvasGroupBlocksRaycastsBinder

Binds CanvasGroup.blocksRaycasts.

InterfaceDescription
IBinder<bool>Sets blocksRaycasts

Inspector properties

PropertyDescription
_converterOptional value converter (for example BoolInvertConverter)

Modes: OneWay, OneTime, OneWayToSource (TwoWay is not allowed).


CanvasGroupIgnoreParentGroupsBinder

Binds CanvasGroup.ignoreParentGroups.

InterfaceDescription
IBinder<bool>Sets ignoreParentGroups

Modes: OneWay, OneTime, OneWayToSource (TwoWay is not allowed).


Example: a panel with controlled opacity and interactivity

[ViewModel]
public partial class ModalViewModel
{
[OneWayBind] private float _overlayAlpha;
[OneWayBind] private bool _isInteractable;
[OneWayBind] private bool _blocksRaycasts;
}

See also