using UnityEngine; public class PlaySoundAndDestroy : MonoBehaviour { private void OnEnable() { var time = GetComponent().clip.length; Destroy(gameObject, time); } }