User Tools


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 have Base Volume and Base Pitch fields. These, among with any component-specific sound fields, influence the final volume of an AudioSource.
Clips
Clips list of SoundComponent
  • Each SoundComponent has a list of AudioClips.
  • If more than one AudioClip is assigned a random AudioClip will be played each time. Note that SoundComponents which play looped sounds - such as EngineRunningComponent - will only use the first AudioClip.
  • Changing AudioClips at runtime will not automatically change the current playing clip.

Scripting

  • Get the first AudioClip in the Clips list:
soundComponent.Clip
  • Get i-th AudioClip in the Clips list:
soundComponent.Clips[i]
  • Get the first AudioSource in the Sources list:
soundComponent.Source
  • Get i-th AudioSource in the Sources list:
soundComponent.Sources[i]
  • Enable / disable SoundComponent:
soundComponent.Enable();
soundComponent.Disable();
  • To get/set volume and pitch use GetVolume, SetVolume, GetPitch and SetPitch instead of getting and setting the values directly from AudioSource. This ensures that the master settings are applied to the values.