17 lines
415 B
C#
17 lines
415 B
C#
using UnityEngine;
|
|
|
|
//thomas09
|
|
//edited script to not destroy the object now. Since it is pooled.
|
|
public class AudioAutoDestroy : MonoBehaviour
|
|
{
|
|
private AudioSource audioSource;
|
|
|
|
private void Awake() => audioSource = GetComponent<AudioSource>();
|
|
private void Update()
|
|
{
|
|
if (!audioSource.isPlaying)
|
|
{
|
|
AudioManager.Instance.DisableSource(audioSource);
|
|
}
|
|
}
|
|
} |