// Use this for initialization
 void Awake()
 {
     if (audioSourcesInstance == null)
     {
         audioSourcesInstance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #2
0
        // Use this for initialization
        void Awake()
        {
            if (instance == null)
            {
                instance     = this;
                audioSources = GetComponents <AudioSource>();

                DontDestroyOnLoad(gameObject);
            }
            else
            {
                Destroy(gameObject);
            }
        }