public AudioSource audioSource; public AudioClip audioClip; [Range(0, 1)] public float volume; void Start() { audioSource = GetComponent<AudioSource>(); } void DoStuff() { audioSource.PlayOneShot(audioClip, volume); }