Music Plays but not sound effects

I don’t understand why these sound clips have stopped working:

Here we see that the print statements are appearing in the console:

This is how I have defined them in code:

This is how it is defined in the Inspector:

And this is how it looks in the hiarchy:

After two days its time for me to give-up and consult with the experts.

Hi @RetroDan, do you have any other sound effects/music in your game that is working at the moment?

Do you have an AudioListener object? Do you have more than one AudioListener?

Yes I have two sound effects that stopped working.

I have no other sound effects. There is an AudioListener on the Main Camera.
I have music in the background that is working.

In the examples I have seen the PlayClipAtPoint takes a new Vector 3… not sure whether that would make much difference but could be a quick and easy test. Wouldn’t have thought it would matter though.

That said it’s hard to tell from your code snippets what this relates to. Can you pop up a bigger hunk of your code for this?

Happy to have a look again in a bit…

@RetroDan, you have an AudioSource component yes? I don’t see it shown in your screenshots, other than the code reference to it, which I notice is in blue which may suggest it’s referencing the AudioSource class not an instance of it…

… ah, ignore, I’ve just seen that it’s a Static method… sorry…

Update

Found this, it’s from the end of last year, but there might be something useful in it…

http://forum.unity3d.com/threads/unity-5-2-0f-no-sound-function-audiosource-playclipatpoint.354364/

The posts which suggest they have it working mention setting the position to that of the camera. There is also mention of the spatialBlend but I don’t know whether you have a 2D/3D game going on here…

I’ve not used this specific method myself, I have a little soundboard example which plays a clip on a key press, that has an AudioSource as a private member within the script, instantiated in the Start() method where it grabs a reference using GetComponent etc. It’s just a cube in a scene, nothing fancy… happy to share if it’s of any use.

UPDATE: I re-entered everything and the sound effects are now working again but, the volume is so low I could hardly hear it next to the music playing. So I lowered the music volume to 0.1 and cranked the volume of my system now they both play at equal levels. I don’t know if that is a good solution or not. They used to play much louder.

1 Like

Hey @RetroDan - great, so at least there’s no code issue or anything. I guess you could play/tweak the sounds accordingly… if you can pop it up anywhere I’d be happy to try it this end and see how it sounds, different machine/player etc… can feedback… entirely up to you :slight_smile: