About 'PlayClipAtPoint() For SFX'!

In this video (objectives)…

  1. Implement the PlayClipAtPoint() method to ensure our audio clip is played even if our GameObject is destroyed.
  2. Investigate Unity's audio setup to discovery why our audio clip is played at lower volume.
  3. Discuss 2D versus 3D spatial sounds in Unity.
  4. Implement audio track.

After watching (learning outcomes)…

Create sound effects that persist even if the parent GameObject is destroyed.

(Unique Video Reference: 41_RR_CU2)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

Hi guys. Great Course, and very well presented and thought out in general. I am really happy with you taking us through the fault finding process - great incite.

However, I felt that the explanation on the sound issue fell short of target, and, to me at least, was actually misleading. The way I understood the explanation is that bug occurred because the GameObjects are 2D (which, in actuality, they are not), but that “PlayClipAtPoint” requires a 3D parameter. I did a “Print (transform.position)”, to verify, but the object was in fact 3D. So the explanation seemed short coming. I did not get the connection between other sounds playing just fine at their game object position (and heard perfectly well by the “Listener” ), whereas the PlayClipAtPoint didn’t work because it was looking for a 3D reference.

During play I set the Spacial Blend parameter to 2D and could hear the soundFX, but as if in the distance. I think that a better explanation might involve discussing the effects of 3D distance from the “Listener”, and the attenuation of sound per unit distance between the Listener and the GameObject. Or am I on the wrong boat in my thinking here? I also tried to set “Spacial Blend” from the code, but that seemed inaccessible. Is there a way to set this parameter from code?

None the less, I still give this course 10/10.

Thanks for the good discussion on this point.

I can see that one place where we were not clear enough and you misunderstood is your statement of:

“The way I understood the explanation is that bug occurred because the GameObjects are 2D (which, in actuality, they are not), but that “PlayClipAtPoint” requires a 3D parameter.”

The point we were making is not about the GameObjects being 2D (you are right, they are 3D) but that the sound spatial blend is 2D or 3D. So, in simple terms, if the blend is 2D it means that the sound does not have a position in the world. A 3D object (with a vector3 position) can have a 2D spatial blend audio component on it. If all of our game objects have 2D audio, then they will all sound the same.

However, because PlayClipAtPoint forces us to set a vector3 position, if we allow that position to be determined by our game object, then it will be somewhere in the world which is a distance from our audio listener on the camera. You are right that the attenuation will then play a role in how loud it sounds. We eliminate the concern of attentuation by placing the 3D position of the audio clip right on top of the camera so there is 0 distance for drop off.

Hopefully I have understood your question / concern correctly and hopefully my explanation helps.

And many thanks for the 10/10!

1 Like

Privacy & Terms