book_4_sparkGenerated
code_blocksInput

Description

The OnSoundEvent property is an event handler that is triggered when a sound event occurs within the SkinnedModelRenderer. This property allows you to define custom behavior in response to sound events associated with the skinned model.

Usage

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

Example

// Example of subscribing to the OnSoundEvent
SkinnedModelRenderer renderer = new SkinnedModelRenderer();

// Define the method to handle the sound event
void HandleSoundEvent(Sandbox.SceneModel.SoundEvent soundEvent)
{
    // Custom logic to handle the sound event
    // For example, logging the event or triggering additional actions
}

// Subscribe to the OnSoundEvent
renderer.OnSoundEvent += HandleSoundEvent;

// Later, you can unsubscribe if needed
// renderer.OnSoundEvent -= HandleSoundEvent;