0
0
Unityframework~10 mins

Audio mixer in Unity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an AudioMixer variable.

Unity
public AudioMixer [1];
Drag options to blanks, or click blank then click option'
AAudioMixer
BaudioMixer
CmixerAudio
DsoundMixer
Attempts:
3 left
💡 Hint
Common Mistakes
Using the class name as the variable name.
Using names that are not descriptive.
2fill in blank
medium

Complete the code to set the volume parameter of the AudioMixer.

Unity
audioMixer.SetFloat("Volume", [1]);
Drag options to blanks, or click blank then click option'
Avolume
BvolumeLevel
CvolumeValue
DvolumeAmount
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that is not defined.
Using a string instead of a float.
3fill in blank
hard

Fix the error in the code to get the current volume from the AudioMixer.

Unity
float currentVolume;
audioMixer.[1]("Volume", out currentVolume);
Drag options to blanks, or click blank then click option'
AGetParameter
BGetVolume
CGetFloat
DSetFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using SetFloat instead of GetFloat.
Using a method that does not exist.
4fill in blank
hard

Fill both blanks to create a method that mutes the AudioMixer by setting volume to -80.

Unity
public void MuteAudio() {
    audioMixer.[1]("Volume", [2]);
}
Drag options to blanks, or click blank then click option'
ASetFloat
B-80f
C-60f
DGetFloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using GetFloat instead of SetFloat.
Using the wrong volume value.
5fill in blank
hard

Fill all three blanks to create a method that adjusts volume only if the new level is above -80.

Unity
public void AdjustVolume(float newVolume) {
    float currentVolume;
    if (audioMixer.[1]("Volume", out currentVolume) && newVolume [2] -80f) {
        audioMixer.[3]("Volume", newVolume);
    }
}
Drag options to blanks, or click blank then click option'
AGetFloat
B>
CSetFloat
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using SetFloat instead of GetFloat in the if condition.
Using the wrong comparison operator.
Setting the volume without checking the condition.