Table of Contents

Class Bindable<T>

Namespace
Bindables
Assembly
Bindables.dll

A container that holds a value and notifies observers when that value changes.

[Serializable]
public class Bindable<T> : IBindWritable<T>, IBindable<T>, IBindable, IBindWritable

Type Parameters

T

The type of the value stored in the bindable.

Inheritance
Bindable<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

Bindable()

public Bindable()

Bindable(T)

Initializes a new bindable with the specified initial value.

public Bindable(T value)

Parameters

value T

The initial value for the bindable.

Fields

_value

[SerializeField]
protected T _value

Field Value

T

Properties

Value

Gets the current value of the bindable.

public T Value { get; set; }

Property Value

T

Methods

NotifyChanged()

Manually triggers change notifications for observers. Use this when the bindable's internal state changes without setting the Value property.

public void NotifyChanged()

SetValueWithoutNotify(T)

Sets the value without triggering change notifications. Useful for initialization or when you want to batch multiple changes.

public void SetValueWithoutNotify(T value)

Parameters

value T

The new value to set.

ToString()

public override string ToString()

Returns

string

Events

OnChange

Event triggered when the bindable value changes.

public event Action OnChange

Event Type

Action

OnChangeWithValue

Event triggered when the bindable value changes, providing the new value.

public event Action<T> OnChangeWithValue

Event Type

Action<T>

Operators

implicit operator T(Bindable<T>)

public static implicit operator T(Bindable<T> prop)

Parameters

prop Bindable<T>

Returns

T