Complete the code to play an audio clip using AudioSource.
AudioSource audio = GetComponent<AudioSource>();
audio.[1]();The Play() method starts playing the audio clip attached to the AudioSource.
Complete the code to set the volume of the AudioSource to half.
AudioSource audio = GetComponent<AudioSource>();
audio.volume = [1];Volume ranges from 0 (silent) to 1 (full volume). Setting it to 0.5 plays sound at half volume.
Fix the error in the code to play a one-shot sound effect.
AudioSource audio = GetComponent<AudioSource>();
audio.[1](clip);PlayOneShot() plays a clip once without interrupting other sounds on the AudioSource.
Fill both blanks to create a looped audio playback with half volume.
AudioSource audio = GetComponent<AudioSource>(); audio.loop = [1]; audio.volume = [2];
Setting loop to true makes the audio repeat. Volume 0.5f sets half volume.
Fill all three blanks to play a clip at a specific position with volume and pitch set.
AudioSource audio = gameObject.AddComponent<AudioSource>(); audio.clip = [1]; audio.volume = [2]; audio.pitch = [3]; audio.Play();
Assign the audio clip variable myClip, set volume to 0.8 for softer sound, and pitch to 1.2 to make it slightly higher.