Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


isReadyToPlay

Returns true if the AudioClip is ready to play (read-only).
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AudioModule
Warning
Deprecated. Use AudioClip.loadState instead to get more detailed information about the loading process.
public bool isReadyToPlay { get; }

Remarks

This applies to any type of AudioClip, regardless whether they load all data at startup, dynamically in the background or streamed from disk or web. In the first case the property will be true when the whole clip has been loaded, while in the streamed cases it will be true when enough data is buffered to start playback.

Examples

using UnityEngine;using UnityEngine.Networking;public class Example : MonoBehaviour{ AudioSource source; void Start() { UnityWebRequest webRequest = UnityWebRequestMultimedia.GetAudioClip("www.example.com", AudioType.UNKNOWN); source = GetComponent<AudioSource>(); source.clip = DownloadHandlerAudioClip.GetContent(webRequest); } void Update() { if (!source.isPlaying && source.clip.isReadyToPlay) { source.Play(); } }}