System.Action<Sandbox.SceneModel/GenericEvent> OnGenericEvent { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The OnGenericEvent property is an event handler that is triggered when a generic animation event occurs within the SkinnedModelRenderer. This property allows you to define custom behavior in response to these animation events by assigning a delegate of type System.Action<Sandbox.SceneModel/GenericEvent>.

Usage

To use the OnGenericEvent property, assign a method that matches the delegate signature System.Action<Sandbox.SceneModel/GenericEvent>. This method will be called whenever a generic animation event is triggered.

Example

// Example of assigning a method to the OnGenericEvent property
SkinnedModelRenderer renderer = new SkinnedModelRenderer();

// Define the method to handle the event
void HandleGenericEvent(Sandbox.SceneModel.GenericEvent evt)
{
    // Custom logic to handle the event
    // For example, logging the event name
    Log.Info($"Generic event triggered: {evt.Name}");
}

// Assign the method to the OnGenericEvent property
renderer.OnGenericEvent = HandleGenericEvent;