public static void DeleteInstance() { if (instance != null) { Destroy(instance.gameObject); instance = null; } }
public void TitleButtonClicked() { level = FindObjectOfType <Level>(); MainSoundScript.DeleteInstance(); ButtonSE.DeleteSEobjectInstance(); level.initParameter(); SceneManager.LoadScene("Title"); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
void Awake() { this.gameObject.GetComponent <AudioSource>().volume = 0.5f; if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } //Sceneを遷移してもオブジェクトが消えないようにする DontDestroyOnLoad(this.gameObject); }