using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class AudioController : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(this);
    }
    void Update()
    {
        if(this.GetComponent<AudioSource>().isPlaying == false)
        {
            Destroy(gameObject);
            Debug.Log("Destroy");
        }
    }

    public void DoDestroyOnLoad()
    {
        SceneManager.MoveGameObjectToScene(this.gameObject, SceneManager.GetActiveScene());
    }
}
