Sound Component
- A base class for all
SoundComponents - Inherits from VehicleComponent, therefore can be turned on or off, enabled or disabled or have LOD set.
Base Volume and Pitch
- All
SoundComponents haveBase VolumeandBase Pitchfields. These, among with any component-specific sound fields, influence the final volume of anAudioSource.
Clips
- Each
SoundComponenthas a list ofAudioClips. - If more than one
AudioClipis assigned a randomAudioClipwill be played each time. Note thatSoundComponents which play looped sounds - such asEngineRunningComponent- will only use the firstAudioClip. - Changing
AudioClips at runtime will not automatically change the current playing clip.
Scripting
- Get the first
AudioClipin theClipslist:
soundComponent.Clip
- Get i-th
AudioClipin theClipslist:
soundComponent.Clips[i]
- Get the first
AudioSourcein theSourceslist:
soundComponent.Source
- Get i-th
AudioSourcein theSourceslist:
soundComponent.Sources[i]
- Enable / disable
SoundComponent:
soundComponent.Enable(); soundComponent.Disable();
- To get/set volume and pitch use
GetVolume,SetVolume,GetPitchandSetPitchinstead of getting and setting the values directly fromAudioSource. This ensures that the master settings are applied to the values.
