Sandbox.SerializedObject/PropertyChangedDelegate OnPropertyChanged { get; set; }

robot_2Generated
code_blocksInput

Description

The OnPropertyChanged property of the SerializedObject class is a delegate that is invoked whenever a property within the serialized object changes. This allows for custom logic to be executed in response to property changes, such as updating UI elements or triggering other events.

Usage

To use the OnPropertyChanged property, assign a method that matches the PropertyChangedDelegate signature to it. This method will be called whenever a property change occurs within the serialized object.

Example

// Example of using OnPropertyChanged

// Define a method that matches the PropertyChangedDelegate signature
void OnPropertyChangeHandler(SerializedProperty property)
{
    // Custom logic to handle the property change
    Console.WriteLine($"Property {property.Name} has changed.");
}

// Create an instance of SerializedObject
SerializedObject serializedObject = new SerializedObject();

// Assign the handler to the OnPropertyChanged delegate
serializedObject.OnPropertyChanged += OnPropertyChangeHandler;

// Now, whenever a property changes in serializedObject, OnPropertyChangeHandler will be invoked.