Game Development Reference
In-Depth Information
Figure 11-9. Explosion Audio Source component in the Inspector
Unlike the Audio Listener, you can have any number of Audio Sources in your game. Sound
performance, like game performance, is limited by the processing power of the target platform.
as well as its specific sound processing and speaker capabilities.
The Audio Source functions like a speaker in the game where the Audio Clip is the actual sound
file the Audio Source plays. Scripting can be used to adjust any properties in the Audio Source
component, including changing the audio clips to be played.
Mute is a simple enabled/disabled toggle for muting the sound. The various Bypass effects are
Pro-version only. Audio Sources with Play On Wake enabled will begin playing when the game
object with audio source component is created. Audio can be looped just like animation clips, where
the audio clip restarts each time it finishes playing all the way through.
Assigning a priority allows Unity to adjust to the audio capability of the platform. Lower-priority
sounds will be swapped out for higher-priority sounds if the performance limitations are exceeded.
In Unity, 0 is the most important.
The relative loudness of the sound clip is controlled with the volume property that uses a 0 to 1
scale indicating 0% to 100% of volume, while pitch controls the frequency of the sound waveform,
where a higher pitch corresponds to a higher key on the musical scale.
You can choose between 2D and 3D sound, which in turn have various adjustable properties.
2D sound is best for audio such as background music that plays uniformly regardless of where the
player is in the game world. 3D sounds vary in relation to the player's position.
 
Search WWH ::




Custom Search