I was wondering how I can adjust the volume of an 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);
}
This is one of my scripts containing a sound and I thought I could control it with the last value of PlayClipAtPoint - but it doesn't change anything and the sound is extremly loud.
Thanks in advance :)
Chrizzly
Here's how I do it:
audio.volume = 0.5f;
the audio
represents the current AudioSource
attached to the object that has your script.
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.