using UnityEngine;
///
/// Helper component, to quickly apply the settings from an AudioConfigurationSO SO to an AudioSource.
/// Useful to add a configuration to the AudioSource that a Timeline is pointing to.
///
[RequireComponent(typeof(AudioSource))]
public class AudioConfigApplier : MonoBehaviour
{
public AudioConfigurationSO config;
private void OnValidate()
{
ConfigureAudioSource();
}
private void Start()
{
ConfigureAudioSource();
}
private void ConfigureAudioSource()
{
if (config != null)
{
AudioSource audioSource = GetComponent();
config.ApplyTo(audioSource);
}
}
}