The OnComponentEnabled
property is an event handler that is triggered when a component is enabled. This property allows you to assign a delegate or lambda expression that will be executed when the component's enabled state changes to true.
The OnComponentEnabled
property is an event handler that is triggered when a component is enabled. This property allows you to assign a delegate or lambda expression that will be executed when the component's enabled state changes to true.
To use the OnComponentEnabled
property, assign a method or lambda expression to it. This method will be called whenever the component is enabled. This is useful for initializing or resetting component-specific data when the component becomes active.
// Example of using OnComponentEnabled public class MyComponent : Component { public MyComponent() { // Assign a lambda expression to OnComponentEnabled OnComponentEnabled = () => { // Code to execute when the component is enabled Log.Info("Component has been enabled."); }; } }