Version: 2019.2
LanguageEnglish
  • C#

AudioSource.clip

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public AudioClip clip;

Description

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.

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(); } }