Game Development Reference
In-Depth Information
As this scene is essentially a 2D still shot, there is no reason to use a 3D sound. Instead of turning
the Volume Rolloff to Linear, this time you will change the audio clip.
5.
From the Sound FX folder, duplicate the Birds clip and name it Birds2D .
6.
Uncheck 3D Sound, and click Apply.
7.
Assign Birds2D as the Audio Source component's Audio Clip.
With Unity GUI, you can track when the user makes changes in the GUI. This cuts down on the
resources so that the values in the menu are updated only when the player actively changes any
of them.
Add the following code below the GUI.EndGroup() line:
8.
if (GUI.changed) {
audio.volume = ambSliderValue; // adjust the audio clip's volume
}
Comment out the print statement.
9.
10.
Save the script.
11.
Click Play, and adjust the volume with the slider.
The volume changes with the slider. In the Inspector, the component's Volume slider will update only
if you deselect and then reselect the Settings Menu.
12.
Stop Play Mode, and save the scene.
13.
Add the scene to the Build Settings, moving it above the GardenLevel1 scene.
14.
Click Build and select Overwrite when the dialog appears.
15.
Close Build Settings.
You will be creating the code to make use of the settings near the end of the chapter.
Credits
The Credits scene is very simple. Once again you can repurpose most of the code. Here you will
learn a simple technique for overriding a GUI Skin on a one-to-one basis.
1.
Open the blocked-in Credits scene.
2.
Focus in on the Main Camera.
3.
Add a new Empty GameObject, and name it Credits.
4.
From the Game Scripts folder, duplicate the MainMenuGUI script and name it
CreditsGUI .
 
Search WWH ::




Custom Search