Description
The OnComponentUpdate
property is an event handler that is invoked during the update cycle of a component. This property allows you to assign a delegate or lambda expression that will be executed every frame, provided the component is active. It is useful for implementing per-frame logic specific to the component.
Usage
To use the OnComponentUpdate
property, assign a method or lambda expression to it. This method will be called every frame during the component's update cycle. Ensure that the component is active for the update to occur.
Example
// Example of using OnComponentUpdate
public class MyComponent : Component
{
public MyComponent()
{
// Assign a lambda expression to OnComponentUpdate
OnComponentUpdate = () =>
{
// Logic to execute every frame
Console.WriteLine("Component is updating");
};
}
}