Select your preferred scripting language. All code snippets will be displayed in this language.
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.
CloseThe length of the audio clip in seconds. (Read Only)
audio.Play(); // Wait for the audio to have finished yield WaitForSeconds (audio.clip.length);
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { IEnumerator Example() { audio.Play(); yield return new WaitForSeconds(audio.clip.length); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as IEnumerator: audio.Play() yield WaitForSeconds(audio.clip.length)