The default AudioClip to play.
AudioSource clip determines the audio clip that will be played next. Assigning clip with a new audio clip does not instantly change the clip that is being played. In the example below clip is assigned as the next AudioClip before it is played.
#pragma strict @RequireComponent(AudioSource) public var otherClip: AudioClip; function Start() { var audio: AudioSource = GetComponent.<AudioSource>(); audio.Play(); new WaitForSeconds(audio.clip.length)audio.clip = otherClip; audio.Play(); }
using UnityEngine; using System.Collections;
[RequireComponent(typeof(AudioSource))] public class ExampleClass : MonoBehaviour { public AudioClip otherClip;
IEnumerator Start() { AudioSource audio = GetComponent<AudioSource>();
audio.Play(); yield return new WaitForSeconds(audio.clip.length); audio.clip = otherClip; audio.Play(); } }
Did you find this page useful? Please give it a rating: