コード例 #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);
        }
コード例 #3
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;
        }
コード例 #4
0
 void OnEnable()
 {
     Instance = this;
 }
コード例 #5
0
 void OnEnable()
 {
     Instance = this;
 }
コード例 #6
0
 void OnDisable()
 {
     if (Instance == this)
         Instance = null;
 }