Audio Problems - Volume & Pan

  1. In the Audio Source (on the Coin GameObject), the Volume slider doesn’t change the sound volume.
    If I change the volume in code, like this, it works as long as the camera (Cinemachine) is not zooming in:
public class CoinPickup : MonoBehaviour
{
    [SerializeField] AudioClip coinPickUpSFX;
    [Range(0.1f, 1f)] [SerializeField] float audioVolume = 0.2f;
    private void OnTriggerEnter2D(Collider2D collision)
    {
        AudioSource.PlayClipAtPoint(coinPickUpSFX, Camera.main.transform.position, audioVolume);
        Destroy(gameObject);
    }
}
  1. The panning is also weird when the camera (Cinemachine) zooms in. It’s all on the left or the right, with no volume on the other side (i.e. fully panned to one side), and it’s ignoring my volume setting above.

These both appear to be related to the Cinemachine cameras, however I can’t find any sound settings in the Cinemachine cameras.

  1. If they are there, could you tell me where?
  2. If not, do you know if there is a way to override the sound settings in Cinemachine?

Thank you,
Jim

Hi Jim,

Have you already tried to add Debug.Logs to your code to see what is going on during runtime? Before you look for any problems in Unity or your code, log the value of audioVolume(?) into your console to figure out if the sound volume value changes during runtime and when you zoom in.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms