48 lines
1006 B
C#
48 lines
1006 B
C#
using DarkTonic.MasterAudio;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
public class BgmConfig : MonoBehaviour
|
|
{
|
|
public string playlistName = "Bgm"; // 플레이 리스트의 이름을 설정합니다.
|
|
|
|
private static BgmConfig instance;
|
|
|
|
public static BgmConfig Instance
|
|
{
|
|
get
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = FindObjectOfType<BgmConfig>();
|
|
|
|
if (instance == null)
|
|
{
|
|
GameObject obj = new GameObject("BgmConfig");
|
|
instance = obj.AddComponent<BgmConfig>();
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
// BGM을 재생합니다.
|
|
MasterAudio.StartPlaylist(playlistName);
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance != null && instance != this)
|
|
{
|
|
Destroy(this.gameObject);
|
|
return;
|
|
}
|
|
instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
}
|
|
|
|
|