|
Plays the clip at position. Automatically cleans up the audio source after it has finished playing.
@script RequireComponent(AudioSource)
// Plays the clip at position
public var clip : AudioClip; //make sure you assign an actual clip here in the inspector
function Start(){
audio.PlayClipAtPoint(clip, Vector3 (5, 1, 2));
}
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class example : MonoBehaviour {
public AudioClip clip;
void Start() {
audio.PlayClipAtPoint(clip, new Vector3(5, 1, 2));
}
}
import UnityEngine
import System.Collections
[RequireComponent(AudioSource)]
class example(MonoBehaviour):
public clip as AudioClip
def Start():
audio.PlayClipAtPoint(clip, Vector3(5, 1, 2))