// Start is called before the first frame update void Awake() { if (s_Instance == null) { s_Instance = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); }
// public static DontDestroyOnLoad_Joystick instance // { // get // { // if(s_Instance == null) // { // //오브젝트가 생성이 안되었을 경우 생성함. // s_Instance = new GameObject("UICanvas").AddComponent<DontDestroyOnLoad_Joystick>(); // } // return s_Instance; // } // } void OnApplicationQuit() { s_Instance = null; }