void Awake()
 {
     if (_instance == null)
     {
         //Create first instance.
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //Destroy any duplicates attempting to occur.
         if (this != _instance)
             Destroy(this.gameObject);
     }
 }
Exemple #2
0
    public void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(this);
        }

        foreach (AudioListener aD in FindObjectsOfType <AudioListener>())
        {
            print(aD.name);
        }
    }
Exemple #3
0
 void Awake()
 {
     if (_instance == null)
     {
         //Create first instance.
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //Destroy any duplicates attempting to occur.
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
 private void Start()
 {
     sh = GetComponent <soundHandler>();
 }