This post describes the components available once you have installed the CRIWARE Unity plug-in.
After installing the plug-in through the Assets -> Import Package menu choosing Custom Package and selecting the criware_unity_plugin.unitypackage file, a number of new components become available in Unity.
The CRIWARE Error Handler component
This component enables the CRIWARE error output. By adding it to your project, you can enable the notification of warnings and errors detected in CRIWARE. During development, use this component for troubleshooting.
The CRIWARE Library Initializer component
This component makes it possible to customize the initialization of CRIWARE, for example by specifying the maximum number of voices that be played simultaneously.
A Library Initializer component should be added to your scene as the plugin may not work properly without it.
However, please note that if another CRIWARE component is used before the library initializer is created, the library will automatically be initialized with the default parameters, and the parameters specified in the Library Initializer component will not be taken into account.
The audio components
This component is used to control the entire sound playback, for example letting you select what ACF project file and CueSheet (ACB and AWB files) the Cues should refer to.
As such, one CRI Atom component must be provided for each scene. However, since it is automatically created when a CRI Atom Source is created (see below), you usually do not need to create it.
CRI Atom Source
The CRI Atom Source is used to play a sound. You can either create the CRI Atom Source as an independent game object, or you can add it to another game object as a component.
The CRI Atom window let you select what sound to play.
CRI Atom Listener
If your game is using 3D positioning for the audio playback -for example if it is a first person shooter -, a CRI Atom Listener component must be added to your scene so that sound attenuation and panning can be correctly calculated. The CRI Atom Listener component is usually added to the Main Camera. Of course, the sound data must be authored with the correct Pan type and attenuation distances in Atom Craft.
Important note on the scripts execution order
Finally, to use the CRIWARE components, you must specify the correct order in which their corresponding scripts will be executed.
You can use Unity’s Script Execution Order function for that. The order should be:
Make sure that all the game scripts that use CRIWARE components are executed after these components.
In the next post, we will see how to prepare the sound data that is used by the plug-in to play sound in Unity.