Forum rules - please read before posting.

Adding sound fx

I've added some sound fx to my game, to give a beep when the player picks up an object. I'm using .wav files downloaded from the Asset Store. In the Object:Use list of actions, after 'Add object to Inventory' I've put an action 'Sound - Play One Shot - then selected the clip to play. This is added to all the objects in all the scenes. My problem is that in some of the scenes the sound plays perfectly, in others they play very quietly, and in other scenes they don't play at all. It's the same audio clip on each object. How can I fix this please?

Comments

  • Ah, sound in unity is a b*tch. Anyway, logarithmic Rolloff will dim audio the farther away it is from the camera. There's a good chance that's the problem (3D sound, which is default in Unity). 

    You'll have to check the settings in your audiosources (Or the Unity's Audio tab). 

    Anyway, sound settings will largely depend on your camera style. Which are you using? is it 3rd person topdown, 3rd person behind the player, first person?

    If you have a style where the camera is always fixed or you just want the sound to always be in your face, then you can go to Unity's Audio tab and set the Volume Rolloff scale and Doppler factor to 0 (in fact, you don't need the Doppler effect at all in most games... usually just for racing games).
  • Thank you for your help. The game is first person and the sound is set to play when a hotspot is in range - raycast length set at 10. Changes to the Audio settings as you suggested seemed to make a difference the first time I tried it, but then went back to the previous problems.
  • edited April 2017
    Weird, worked only the first  time? Maybe it would be a good idea to check if any saved game you have in the project (which you are using in testing) doesn't have the volume settings lowered. 

    Also, are you using oneshots for the audio? I think Unity's audio settings rolloff and doppler settings mostly affect those. If you are using objects with audiosources instead, it might pay off to check their individual settings. Maybe setting them manually to 0 rolloff (or something small like 0.1 or 0.2) and 0 doppler effect might make a difference.

    I've also seen a similar issue in VR, where you sometimes don't hear the audio if you are not facing the object properly. But I don't know if it's related.
  • Are you assigning a Position Transform in your Sound: Play-one shot Action?  It may be related to your camera's position in the scene when this plays.

    It may be better to play your audio through a specific Sound object (using Sound: Play) so that you have complete control over the Sound / AudioSource Inspector properties.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.