Search Unity

PlayClipAtPoint automatically 3D and not 2D

Discussion in 'Audio & Video' started by aNormalGuy, Aug 24, 2016.

  1. aNormalGuy

    aNormalGuy

    Joined:
    Jul 22, 2013
    Posts:
    36
    Hi,

    My issue is that all of my sound effects that I play through PlayClipAtPoint can barely be heard since I updated from 5.0.2 to 5.3.2. It seems like all of them have "Spatial Blend" set to 1 which makes it 3D. Since our game is full 2D I wonder if there's a global setting in the project where I can change it so the standard is 0 on Spatial Blend?

    Or do I have to go through all of our scripts and set the Spatial Blend to 0? Really hope that there's a global setting that I've missed somewhere.
     
  2. SuperNeon

    SuperNeon

    Joined:
    Mar 16, 2014
    Posts:
    85
    Hi,

    PlayClipAtPoint is naturally for 3D sounds. It look weird for me to trying to play 2D sound with this function ^^
    I suggest you to use pan and your own rolloff system if you want to keep 2D sounds.
    Or you can check the roll off settings on your audio source to adjust the min max value :)
     
  3. Hyblademin

    Hyblademin

    Joined:
    Oct 14, 2013
    Posts:
    725
    @aNormalGuy

    Just to be sure you know: 2D game does not mean 2D sound. It's defined here as keeping the source channel mapping intact. In other words, it just plays the sound as-is. 3D means that the sound will get quieter when it's further from the AudioListener, which means that it's usually desirable for 2D games.

    If you can't hear your 3D sounds, you need to change the rolloff properties. I'm not really sure how this works, since I've never used PlayClipAtPoint(), but I'm guessing the created source's values are copied from the Audio Source on the GameObject that called PlayClipAtPoint(). The reason I think this is that the example given in the official documentation for AudioSource.PlayClipAtPoint() uses a RequireComponent directive to add an Audio Source. It's worth a try.

    That said, if you really do want 2D sound, I'm guessing you'd do the same thing, but change the spatial blend instead.

    EDIT: I looked up a few things and discovered that there doesn't appear to be a way to configure the AudioSource created by PlayClipAtPoint(). I don't recommend using this function either way.
     
    Last edited: Sep 7, 2016
  4. aNormalGuy

    aNormalGuy

    Joined:
    Jul 22, 2013
    Posts:
    36
    Thanks for taking your time, I think I have to find another way to play sound effects that's more controlled.