Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Audio The problem with sound. I do not understand how to configure the sound component.

Discussion in 'Audio & Video' started by Laguna_Seca, Jan 11, 2019.

  1. Laguna_Seca

    Laguna_Seca

    Joined:
    Mar 13, 2014
    Posts:
    61
    Hello. I have a car to which I add a sound component.

    Code (CSharp):
    1.  
    2. var newAudio = go.AddComponent<AudioSource>();
    3.  
    4. newAudio.spatialBlend = 1;
    5.  
    6. newAudio.clip = clip;
    7.  
    8. newAudio.loop = loop;
    9.  
    10. newAudio.playOnAwake = playAwake;
    11.  
    12. newAudio.volume = vol;
    13.  
    14. newAudio.pitch = pitch;
    15.  
    16. newAudio.minDistance = minDistance;
    17.  
    18. newAudio.maxDistance = maxDistance;
    19.  
    This is what this component looks like:

    a1.png

    With these settings, the sound is not audible at all. The sound appears if you set the minimum to 20 and the maximum to 100.

    My problem is this: I have several locations on the same stage. They are far from each other. When I move to another location, I turn off the main camera and turn on the additional one. There is no sound listener on the secondary camera, but the sound appears and becomes very loud.

    How is this even possible? Why does the sound work if there is no listener on the camera? And how to properly adjust the sound for 3D space?

    I add a component from a script, since an object is created on the fly. I do not have the ability to adjust the curves.