当前正在播放该 clip 吗?(只读)
注意:AudioSource.isPlaying 将在调用 AudioSource.Pause() 时返回 false。 当您再次使用 AudioSource.Play() 时,它将返回 true。
// When the audio component has stopped playing, play otherClip
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public AudioClip otherClip;
AudioSource audioSource;
void Start()
{
audioSource = GetComponent<AudioSource>();
}
void Update()
{
if (!audioSource.isPlaying)
{
audioSource.clip = otherClip;
audioSource.Play();
}
}
}