Game Toolkit for Unity
Learn more about using music, sound types, sound assignments and sound channels.
Music is an important part of a game. You can set up music clips with optional in-track loop setup in Game > Music.
Beside simple playback, you can change also fade between clips and fade them in/out.
Music clips are played on music channels, you can set up default music channels in Game > Game Settings – music channels can also use an Audio Mixer Group (Unity feature) for advanced audio handling. Using multiple music channels allows you to e.g. an environmental track as well as a regular BGM track and let the player change their volumes independently.
You can change the played music clip (also stop or fade) using a Change Music node.
The Music Player component, like schematic nodes, allows you to play, stop or fade music clips.
The component will use the selected clip and play setup when the scene is loaded (or the component’s game object is spawned).
You want to play a different sound depending on which game object was hit by a bullet? Sound types are an easy way to do this without having to change schematics or override audio resources.
In short, you can assign an audio clip to a sound type – by playing a sound type on a game object (e.g. in a Play Audio node), you can just play whatever audio clip is assigned to the sound type on a game object.
You can assign audio clips to sound types in Sound Templates and Sound Assignment components.
Sound types are set up in Base/Control > Sound Types.
A sound template is a reusable assignment of audio clips to sound types. The templates can be used in Sound Assignment components to add the audio clips to a game object.
If you need to change the audio clip assigned to a sound type (or add additional assignments), you only need to change the sound template instead of having to change it on all prefabs or game objects that use it.
Sound templates are set up in Templates > Sound Templates.
A Sound Assignment component adds the audio clips assigned to sound types to a game object.
You can use a Sound Template as a basis for audio clip assignments to sound types and add additional assignments to the component directly. Adding a sound directly to the component will overrule assignments from the used template.
When playing a sound type (e.g. in a Play Audio node), the sound assignment component is used to find the audio clip that is assigned to the sound type.
A Raycast node is used to hit game objects with a gun. The found game objects (added to a local Selected Data in the schematic) are used in a Play Sound node to play a sound type on them.
The game objects use Sound Assignment components to assign different audio clips to sound types:
Depending on an equipped weapon, a different prefab is attached to the player. When attacking enemies, a Play Sound node is used to play a sound type on the equipped weapon prefab.
The prefabs use Sound Assignment components to assign different audio clips to sound types:
Use sound channels to manage volumes of separate audio channels, e.g. menu sounds, dialogue and general game sounds (like damage sounds). You can set up default sound channels in Game > Game Settings – sound channels can also use an Audio Mixer Group (Unity feature) for advanced audio handling.
The Sound Channel component can be used to drive the volume of an Audio Source component by a Makinom sound channel and use the channel’s audio mixer group.
© 2015 Gaming is Love e.U.
Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!