Ejemplo n.º 1
0
        public void Initialize(PureData pureData)
        {
            listener = Object.FindObjectOfType <AudioListener>();

            if (listener == null)
            {
                GameObject newListener = new GameObject("Listener");
                listener = newListener.AddComponent <AudioListener>();
                listener.transform.Reset();
                Logger.LogWarning("No listener was found in the scene. One was automatically created.");
            }

            // HACK Trick to activate OnAudioFilterRead
            listener.enabled = false;
            filterRead       = listener.GetOrAddComponent <PureDataFilterRead>();
            filterRead.Initialize(pureData);
            listener.enabled = true;
            transform        = listener.transform;
        }