- Home /
Question by
KJStudios · Dec 28, 2012 at 09:30 PM ·
javascriptaudioplayoneshot
what is wrong with the javascript code?
function Update()
{
var clip : AudioClip;
if(Input.GetMouseButtonDown(0))
{
// Plays the shoot animation - stops all other animations
animation.Play("shoot", PlayMode.StopAll);
audio.PlayOneShot("shotgun");
}
}
Why does it tell me that
there is no apropriate bersion of "unityengine.audiosource.playoneshot"
Comment
Answer by paulaceccon · Dec 29, 2012 at 11:53 PM
You are passing a string as parameter. You should pass a clip.
http://docs.unity3d.com/Documentation/ScriptReference/AudioSource.PlayOneShot.html
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Has anyone got a Toggle key script? 3 Answers
Detect OnTriggerEnter with tags 0 Answers
Changing material Color using RBG? 3 Answers
Int and Javascript help 2 Answers