Astra Child

Bindable

Estimated reading: 2 minutes 0 views

What is a Bindable?

A Bindable is an object that can be bound to a Bind object to synchronize its value with other Bindables. It can be used to connect UI elements with game logic scripts, or to synchronize data between different parts of a system.

How it works

A Bindable has a unique identifier called a guid, which is used to identify it within a Bind object. It can be connected to a single Bind object at any point in time.

Connection Types

A Bindable has three connection types:

  1. Sender – the Bindable only sends value updates to the Bind, when its value changes. It does not receive value updates from the Bind.
  2. Bidirectional – the Bindable sends value updates to the Bind, when its value changes. It also receives value updates from the Bind.
  3. Receiver – the Bindable only receives value updates from the Bind. It does not send value updates to the Bind, when its value changes.
Bindy Value

A Bindable has a value of type object, called BindyValue that is used to bind a value to a target object and a variable name. This is the value that is synchronized between Bindables that are connected to the same Bind object. BindyValue can be of any type, including custom types. BindyValue has an onValueChanged event that is invoked when its value changes.

On Bind Behavior

When a Bindable is added to a Bind, it can have one of three OnBindBehavior values:

  1. DoNothing – the Bindable does not send or receive any value.
  2. SetValue – the Bindable sends its value to the Bind.
  3. GetValue – the Bindable receives the value from the Bind, by checking the last value sent by the Bind.
Update Modes

A Bindable has three update modes that determine how it updates its value:

  1. Realtime – the Bindable updates its value every frame, regardless of the frame rate.
  2. FrameBased – the Bindable updates its value based on the FrameInterval (every X frames).
  3. TimeBased – the Bindable updates its value based on the TimeInterval (every X seconds).

In summary, a Bindable is a key component of the Bindy system, allowing for easy and flexible synchronization of values between objects.

Share this Doc
CONTENTS
Scroll to Top