예제 #1
0
 // Start is called before the first frame update
 void Awake()
 {
     if (Backgroundmusic == null)
     {
         Backgroundmusic = this;
         DontDestroyOnLoad(Backgroundmusic);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 void MakeSingletone()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }