<aside> 📄 This script plays an AudioClip and scales the Audio Source volume by volumeScale.
</aside>
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class ExampleClass :MonoBehaviour
{
publicAudioClip impact;
AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
}
void OnCollisionEnter()
{
audioSource.PlayOneShot(impact, 0.7F);
}
}