InAudio Documentation

Advanced Audio Plugin for Unity

User Tools

Site Tools


events

Events

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.

Control

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.

Window

  1. Event hierarchy as known from the other windows.
  2. Object to act upon can be dragged here so add to an action with this object.
  3. The delay for the event to activate in seconds.
  4. The action list for this event. Two actions can be seen in the red rectangle.
  5. Drag handle to reorder actions
  6. The type of the actions
  7. The data it acts upon.
  8. Find the data in use or remove this action.
  9. The selected action parameters.

In Play mode you can also test out events by dragging a game object to the preview target field and press “Post event”.

Create 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

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.

Changing Type & Data

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.

If you want to change the type of it has been deleted, simply drag a another node.

Adding actions

There are several ways to add an action as illustrated in the pictures below.

  1. Drag a node from another window onto an event (pictured below). This adds the “Visitors” audio to the “Cutscene Enter”
  2. - Click on the bar to adding an event

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.

This shows how to drag an audio node onto the event. Either one of the destinations will work and does the exact same thing.

events.txt · Last modified: 2015/07/11 12:59 by peterolsted