17 lines
348 B
C#
17 lines
348 B
C#
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(AudioSource))]
|
|
public class SelfDestructAfterPlaying : MonoBehaviour {
|
|
private AudioSource Source;
|
|
|
|
private void Awake() {
|
|
Source = GetComponent<AudioSource>();
|
|
}
|
|
|
|
private void LateUpdate() {
|
|
if (!Source.isPlaying) {
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|