void OnDestroy()
 {
     if (!Q3DAudioManager.DisableIfQ3DNotActive(this))
     {
         UpdatePlayingThisFrame();//release q3d_audio resources
     }
 }
    void Awake()
    {
        if (Q3DAudioManager.DisableIfQ3DNotActive(this))
        {
            return;
        }

        //create singleton if necessary -- do this as early as possible so logging mechanism on Windows can be setup
        if (!smQ3DAudioManagerInstance)
        {
            GameObject go = new GameObject("Q3DAudioManager");
            smQ3DAudioManagerInstance = go.AddComponent <Q3DAudioManager>();
        }

        GetComponent <AudioListener>().enabled = enabled;
    }
Example #3
0
    void Awake()
    {
        if (Q3DAudioManager.DisableIfQ3DNotActive(this))
        {
            return;
        }

        mAudioReverbZone = GetComponent <AudioReverbZone>();
        if (!mAudioReverbZone)
        {
            DisableBecauseUninitialized();
        }
        else
        {
            Q3DAudioListener.mQ3DAudioRoomList.Add(this);
        }
    }
    void Awake()
    {
        if (Q3DAudioManager.DisableIfQ3DNotActive(this))
        {
            return;
        }

        int idInt;

        do
        {
            //Unity's audio interface only passes floats; use 23-bit mantissa of IEEE 32bit float to keep things simple with non-fractional float ids
            idInt = smRandom.Next(2 << 23);
        } while (smIdHashMap.ContainsKey(idInt));
        mId = (float)idInt;
        smIdHashMap.Add(idInt, mId);

        if (!InitializeAudioSource())
        {
            return;
        }
    }