- Email email@example.com
InAudio supports two ways of controlling audio playback, code & events. This page describes the event approach. To play, stop, break, setting the volume etc. you create an event to do it. This enables reuse and control from a centralized placed as things can be changed cross-project without touching the inspector. Activating an event is called to 'Post' an event.
To open the Event window, go to
Window/InAudio/Event Window or press alt+shift+3.
To control the audio on a granular level, all events is posted to a game object. If you for instance play a sound for reloading a firearm so an event to play a reload sound is posted to the gun. However the played switched weapon before the reloading is done, so a stop event is posted to that gun being switched away from.
To make this work, the events has to be posted to the same game object, otherwise InAudio has no way of knowing what belongs to which game objects. If you want to fire and forget, just assign any game object.
In Play mode you can also test out events by dragging a game object to the preview target field and press “Post event”.
To create an event right click on a folder in the window and press
Create Child/Event. Folders are just for organizing.
Another way is to simply drag an audio onto a folder and an event will be created along with an appropriate action.
Actions is where the real action happens. Without actions, events does not do anything. Actions define what an event should do and an event can contain any number of actions.
An action contains three things. The type of event, the data for that type of event and the object it acts upon.
An example of an action can be seen here.
For a detailed list, see Event Actions for a description of all actions and their parameters.
After an action is created, the type and data can still be changed.
As shown below, clicking on the action type button allows for chancing the type. If the types is not compatible, like you cannot change the volume a bank, the connection will be lost until a compatible type is added like in the second picture below.
There are several ways to add an action as illustrated in the pictures below.
The benefit with the first approach is that is automatically adds the desired data and an appropriate action type. In this example it would add an action as the “Visitors” action.