Skip to main content

GameObject Binders

Binders that drive GameObject properties.


GameObjectVisibleBinder

Binds visibility through GameObject.SetActive(bool).

InterfaceDescription
IBinder<bool>Sets the object's active state
IReverseBinder<bool>Sends the current state (OneWayToSource)

Inspector properties

PropertyDescription
_converterOptional value converter (for example BoolInvertConverter)

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

[ViewModel]
public partial class PanelViewModel
{
[OneWayBind] private bool _isVisible;
}

Inverted example

To hide the object when the value is true:

[ViewModel]
public partial class LoadingViewModel
{
[OneWayBind] private bool _isLoading;
// BoolInvertConverter → the GameObject is hidden while isLoading = true
}

GameObjectTagBinder

Binds the tag, GameObject.tag.

InterfaceDescription
IBinder<string>Sets the tag
IReverseBinder<string>Sends the current tag (OneWayToSource)

Inspector properties

PropertyDescription
ConverterIConverter<string?, string?> (optional)

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


GameObjectTagSwitcherBinder

bool → one of two tags.

Modes: OneWay, OneTime.


GameObjectVisibleByBindMonoBinder

A MonoBinder wrapper for GameObjectVisibleBinder. Binds the visibility of a target GameObject through the Inspector.

Unlike the plain GameObjectVisibleBinder, it drives the active state of another GameObject, not the one the binder sits on.


Example: showing and hiding panels

[ViewModel]
public partial class UIViewModel
{
[OneWayBind] private bool _showInventory;
[OneWayBind] private bool _showMap;
[OneWayBind] private bool _showSettings;
}

In the View bind a GameObjectVisibleBinder to each panel. The panels show and hide as the ViewModel properties change.


See also