AudioSource 音频源

Inherits from Behaviour

A representation of audio sources in 3D.

表示在3D空间中的音频源。

An AudioSource is attached to a GameObject for playing back sounds in a 3D environment. Mono sounds play back 3D. In order to play 3D sounds you also need to have a AudioListener. The audio listener is normally attached to the camera you want to use. Stereo sounds are always played back without distance based attenuation.

AudioSource附加到一个GameObject用于在3D环境中播放声音。单声道声音以3D播放。为了播放3D声音,也需要有一个AudioListener。音频监听器通常附加在使用的相机上。立体声总是不以距离为基础衰减。

You can play a single audio clip using Play, Pause and Stop. You can also adjust its volume while playing using volume property, or seek using time. Multiple sounds can be played on one AudioSource using PlayOneShot. You can play a clip at a static position in 3D space using PlayClipAtPoint.

你可以使用PlayPauseStop来播放音频剪辑。也可以在播放时使用volume属性调整音量,或者使用time来定位。多个声音可以使用PlayOneShot在一个AudioSource上播放。可以使用PlayClipAtPoint在3D空间中的一个静态位置播放剪辑。

参见:AudioListener, AudioClip

Variables变量

Functions函数

Class Functions类函数

Inherited members继承成员

Inherited Variables继承变量

Inherited Functions继承函数

Inherited Class Functions继承类函数

最后修改:2011年4月6日 Wednesday 10:44

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。