您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
688 B
31 行
688 B
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
/// <summary>
|
|
/// Helper component, to quickly apply the settings from an <c>AudioConfigurationSO</c> SO to an <c>AudioSource</c>.
|
|
/// Useful to add a configuration to the AudioSource that a Timeline is pointing to.
|
|
/// </summary>
|
|
[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<AudioSource>();
|
|
config.ApplyTo(audioSource);
|
|
}
|
|
}
|
|
}
|