Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AudioSource.PlayClipAtPoint and AudioMixer

Discussion in 'Audio & Video' started by IntDev, Aug 13, 2015.

  1. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    If I use AudioSource.PlayClipAtPoint() how can I deal with the fact that I need my AudioMixer to handle that sound?
     
  2. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    967
    You can't, you need to use a proper audiosource if you want any kind of control over the clip.

    I think the most common solution is to use a pooling system where you just instantiate a new object with an audiosource from the pool to play the sound, and then return it to the pool once the sound has finished playing.
     
  3. IntDev

    IntDev

    Joined:
    Jan 14, 2013
    Posts:
    152
    Would be nice if unity support that. Maybe a AudioSource.PlayClipAtPoint(clip, pos, mixer) or yet audioMixer.Play(clip).
    This function is good for playing a sound when destroying an object.
     
    tbriz and Detamine like this.