using UnityEngine; [RequireComponent(typeof(AudioSource))] public class SelfDestructAfterPlaying : MonoBehaviour { private AudioSource Source; private void Awake() { Source = GetComponent(); } private void LateUpdate() { if (!Source.isPlaying) { Destroy(gameObject); } } }