Play Sounds

From ETC Public Wiki
Jump to: navigation, search

A Sound in Unity is comprised of two parts.

The First is the Audio Clip. The Audio Clip is the actual sound you want to play. To access this dynamically you must load in an audio clip.

The Second is an Audio Source. Once an Audio Source is connected to your object all you need to do is play the clip through the source.
Below is an example of this.

using UnityEngine;
using System.Collections;

class audioTest:MonoBehaviour{
     public AudioClip clip;

     void Start(){

For additional information about audio sources feel free to reference unity.