AudioSource.isPlaying 正播放?
var isPlaying : bool
Description描述
Is the clip playing right now (Read Only)?
剪辑现在正在播放(只读)?
Note: AudioSource.isPlaying will return false when AudioSource.Pause() is called. When you use AudioSource.Play() again back, it will return true.
注意:当AudioSource.Pause()被调用,AudioSource.isPlaying将返回false。当使用AudioSource.Play()再次播放,将返回true。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public AudioClip otherClip;
void Update() {
if (!audio.isPlaying) {
audio.clip = otherClip;
audio.Play();
}
}
}
// When the audio component has stopped playing, play otherClip
//当音频组件被停止播放,播放otherClip
var otherClip : AudioClip;
function Update (){
if (!audio.isPlaying){
audio.clip = otherClip;
audio.Play();
}
}
最后修改:2011年4月5日 Tuesday 13:51