You can use Sound actions to play an audio clip when the receiver component is interacted with in the specified way. Sound actions offer you a wide range of interactive possibilities, such as audible touch feedback for the user, or ambient music.
Creating a Sound Action
Select the component to trigger the action. Go to the Actions tab in Inspector and click the button below the Actions list. Then select the Sound action from the pop-up menu.
You can now select the Event, Receiver, and other general settings for the action. For more information on general settings of actions, see Using Actions.
Sound Action Settings
Sound actions offer the following settings:
- Asset: Choose an audio asset to be played when the action is triggered.
- Action Mode: Select the kind of action triggered. Play always starts the sound playback. Toggle Play toggles the mode, i.e. if playback is already running, the playback stops, and if no playback is running, it starts. The Stop mode always halts the playback.
- Loop: Select to make the audio asset play in a continuous loop.
Using the Sound Action
Sound actions are useful to provide audio feedback on a performed touch event. You may also want to use background music to add to the atmosphere of each scene in your multi-touch scenario.
Audio assets triggered by a Sound action have no interface controls, so they will be played back unless acted upon by some action. They may even continue to play indefinitely if you set the Loop option. For this reason, it's may be important to provide some sort of touch control over the Sound action, if you want to give users a way to stop its playback.