Audio and AudioData
Last updated
Last updated
The VehicleAudio component controls all the audio for the vehicle. You can select to add this component when creating your vehicles with the prefab builder, it will get added to the same GameObject as the VehicleBehaviour.
Here you can add/ remove the AudioData you want your vehicles to use. You do not need to add any AudioSource components, they are created at run time.
Make sure you also assign a DriftSettings asset.
Audio Data are saved as ScriptableObjects and are required for adding sounds to your vehicles. The audio is done this way to allow for reuse across multiple vehicles, which means you can quickly change sounds on multiple vehicles.
To create a new AudioData asset right mouse click in the project window -> Create -> e23 -> AVC -> Audio Data
Audio ID (optional) - Enter a name for this audio, if you are using a 'Custom' AudioType, otherwise it can be left blank.
Audio Type - Select the type of audio this asset is for. The options are self explanatory EngineStart, EngineRunning, EngineOff, Collision, Break, Drift, Custom.
Audio Clip - Assign the audio clip this asset will be using.
Play On Awake - Sets this same flag on the created AudioSource.
Loop - Sets this same flag on the created AudioSource.
Audio Mixer Group - Sets this same flag on the created AudioSource.
Layer Mask - Currently not used by AVC, but available for you if you write a custom class that requires it.
These are all the settings found on the Unity AudioSource. Setting them here will apply them to the audio source in game. For more information on what they do, see the Unity docs.
This component is used by AVC for custom sounds on collisions, add this to any object you wish to have a custom SFX on, enter the required AudioID, and as long as the AudioData for it is added to the vehicles, then this sound will play on collision.