MIF_E31211986/Assets/Script/BackgroundMusic.cs

22 lines
417 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackgroundMusic : MonoBehaviour
{
private static BackgroundMusic backgroundMusic;
void Awake()
{
if(backgroundMusic == null)
{
backgroundMusic = this;
DontDestroyOnLoad(backgroundMusic);
}
else
{
Destroy(gameObject);
}
}
}