4월 3일

변재웅·2025년 4월 3일
public void Awake()
 {
     //게임시작 신에서 넘어갈 때 파괴되지 않고 그대로 남아있을 수 있어
     if(instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         //메인 신에서 남아있는 오디오매니저를 삭제
         Destroy(gameObject);
     }
 }
 // Start is called once before the first execution of Update after the MonoBehaviour is created
 void Start()
 {
     audioSource = GetComponent<AudioSource>();

     audioSource.clip = this.clip;
     audioSource.Play();
 }

0개의 댓글