当前是否正在播放 剪辑(只读)?
注意: 当调用 AudioSource.Pause()
时,AudioSource.isPlaying 返回 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(); } } }