void Awake()
       {
             if(Instance)
                 DestroyImmediate(gameObject);
             else
             {
                 DontDestroyOnLoad(gameObject);
                 Instance = this;
             }
       }
Пример #2
0
 void Awake()
 {
     if (instance)
     {
         Destroy(audio);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(audio);
     }
 }