예제 #1
0
 public static void DeleteInstance()
 {
     if (instance != null)
     {
         Destroy(instance.gameObject);
         instance = null;
     }
 }
예제 #2
0
    public void TitleButtonClicked()
    {
        level = FindObjectOfType <Level>();

        MainSoundScript.DeleteInstance();
        ButtonSE.DeleteSEobjectInstance();
        level.initParameter();
        SceneManager.LoadScene("Title");
    }
예제 #3
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
예제 #5
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
예제 #6
0
    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);
    }