Пример #1
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        foreach (Sound s in sounds)
        {
            s.source              = gameObject.AddComponent <AudioSource>();
            s.source.clip         = s.clip;
            s.source.volume       = s.volume;
            s.source.pitch        = s.pitch;
            s.source.loop         = s.loop;
            s.source.spatialBlend = s.spatialBlend;
            s.source.maxDistance  = s.maxDistance;
        }
    }
Пример #2
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #3
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #4
0
 private void Awake()
 {
     Ins    = this;
     audios = new List <AudioSource>();
 }