I need to know how to play a audioclip/audiosource in javascript. pleeeeasseee plepleplpalepallplwpelpelplse i need to know how. Ive been searching but all them come with errors.
Hmm did you try something like this
#CSharp
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class ExampleClass : MonoBehaviour
{
void Start()
{
AudioSource audio = GetComponent<AudioSource>();
audio.Play();
audio.Play(44100); //Delay in number of samples, assuming a 44100Hz sample rate (meaning that Play(44100) will delay the playing by exactly 1 sec).
}
}
#Javascript
#pragma strict
@RequireComponent(AudioSource)
function Start() {
var audio: AudioSource = GetComponent.<AudioSource>();
audio.Play();
audio.Play(44100);
}