Builder Set( T obj, string targetName, System.Action onChanged )
Builder Set( T obj, System.Func<U> read, System.Action<U> write )
Builder Set( Proxy binding )

robot_2Generated
code_blocksInput

Description

The Set method in the Sandbox.Bind.Builder class is used to establish a binding between a property of an object and a target property name. This method allows you to specify an action that will be triggered whenever the value of the target property changes.

Usage

To use the Set method, you need to provide the following parameters:

  • obj: The object whose property you want to bind.
  • targetName: A string representing the name of the target property to bind to.
  • onChanged: An action that will be executed when the target property changes.

This method returns a Sandbox.Bind.Builder instance, allowing for method chaining to further configure the binding.

Example

// Example of using the Set method
var builder = new Sandbox.Bind.Builder();

// Assume we have an object with a property named "Health"
var player = new Player();

// Bind the "Health" property to a target property name "PlayerHealth"
// and specify an action to execute when the property changes
builder.Set(player, "PlayerHealth", () => {
    // Action to perform when "PlayerHealth" changes
    // For example, update UI or trigger an event
    UpdateHealthUI(player.Health);
});