AudioSource.Play 播放

function Play (delay : UInt64 = 0) : void


Plays the clip.


Delay allows a source to be played later at a specific sample-accurate point in time. Note that the delay must be set according to the reference output rate of 44.1 Khz, meaning that Play(44100) will delay the playing by exactly 1 sec. Note: To obtain sample accuracy with an AudioClip with a different samplerate (than 44.1 khz) you have to do the math yourselves. Delaying an audiosource with an attached AudioClip with samplerate of, say, 32 khz, with 16k samples(.5 sec) is done by Play(22050). ((44100/32000) * 16000 = 22050).

延迟允许一个源在一个特定精确采样时间点之后播放。请注意,延迟必须设置根据44.1 Khz的输出率,意思是播放(44100) 将延迟播放刚好1秒。注意:为了获得AudioClip准确的采样,带有不同的采样率,你必须做自己的计算。延迟一个附加AudioClip的AudioSource,带有采样率,32 khz,带有16k采样(.5 秒)来播放(22050)。 ((44100/32000) * 16000 = 22050)。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {

// Delay a clip by 1 sec (44100 samples) 延迟一个剪辑1秒


参见:Stop, Pause, clip函数

Page last updated: 2011-4-6