public static scr_soundManager instance; //다른 스크립트에서 이스크립트에있는 함수를 호출할때 쓰임 void Awake() // Start함수보다 먼저 호출됨 { if (scr_soundManager.instance == null) //게임시작했을때 이 instance가 없을때 { scr_soundManager.instance = this; // instance를 생성 } }
// Use this for initialization void Awake() { //SetInstanceToThisGameObjectIsIstanceIsNull if(instance == null) { instance = this; } //IfInstanceIsNotThisObjectDestroyObject else if (instance != this) { Destroy(gameObject); } //DontDestroyGameObjectWhenLoadingScenes DontDestroyOnLoad(gameObject); }