更改音频剪辑的音量

Change volume of audio clip

我想知道如何调整音频剪辑的音量。

public AudioClip collectCoinSound;

private void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag != "Player") return;

    GameManager.highscore += 100;
    AudioSource.PlayClipAtPoint(collectCoinSound, transform.position, 0.5f);
    Destroy(this.gameObject);
}

这是我的一个包含声音的脚本,我想我可以用 PlayClipAtPoint 的最后一个值来控制它 - 但它没有改变任何东西而且声音非常响亮。

提前致谢:)

灰熊

这是我的做法:

audio.volume  = 0.5f;

audio 表示当前 AudioSource 附加到具有您的脚本的对象。

希望对您有所帮助。