sea-battle-vr/Assets/Scripts/Gameplay/Effects/PlaySoundAndDestroy.cs

11 lines
211 B
C#

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