AudioSource.PlayOneShot 播放一个音频剪辑

function PlayOneShot (clip : AudioClip, volumeScale : float = 1.0F) : void

Description描述

Plays an AudioClip.

播放一个音频剪辑。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public AudioClip impact;

	void OnCollisionEnter() {

		audio.PlayOneShot(impact);

	}

}
// Play impact audio clip when colliding with something

//当碰到什么东西时,播放音频剪辑

var impact : AudioClip;

function OnCollisionEnter () {

	audio.PlayOneShot(impact);

}
Page last updated: 2011-4-6