Пример #1
0
 void OnDisable()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
Пример #2
0
        /// <summary>
        /// Returns an instance of the Audio2dListener
        /// </summary>
        /// <returns></returns>
        public static Audio2DListener GetInstance()
        {
            if (Instance == null)
            {
                // create a new one
                var found = FindObjectOfType <AudioListener>();

                if (found == null)
                {
                    Debug.LogError("No AudioListener found !");
                    return(null);
                }

                Instance = found.gameObject.AddComponent <Audio2DListener>();
            }

            return(Instance);
        }
        /// <summary>
        /// Returns an instance of the Audio2dListener
        /// </summary>
        /// <returns></returns>
        public static Audio2DListener GetInstance()
        {
            if (Instance == null)
            {
                // create a new one
                var found = FindObjectOfType<AudioListener>();

                if (found == null)
                {
                    Debug.LogError("No AudioListener found !");
                    return null;
                }

                Instance = found.gameObject.AddComponent<Audio2DListener>();
            }

            return Instance;
        }
Пример #4
0
 void OnEnable()
 {
     Instance = this;
 }
 void OnEnable()
 {
     Instance = this;
 }
 void OnDisable()
 {
     if (Instance == this)
         Instance = null;
 }