- Home /
Audio source problem
I have this
var clip : AudioClip;
function Update () { if( Input.GetButtonDown("w") ) { audio.Play(AudioClip);
} }
but unity says: no appropriate version of unityengine.audiosource,...
what do i need to do??
Answer by Eric5h5 · Dec 19, 2010 at 08:10 PM
You're using the type instead of the variable. Should be just "audio.Play()", and assign the clip using "audio.clip = clip".
I now have this: var clip : AudioClip;
function Update () { if( Input.GetButtonDown("w") ) { audio.Play(clip);
} }
still the same error
I now have audio.clip = Clip;
function Update () { if( Input.GetButtonDown("w") ) { audio.Play();
} }
But it now says clip is an unknown identifier,..
sorry for being a noob
Don't remove "var clip : AudioClip". Put audio.clip = clip in Start or wherever.
Your answer
Follow this Question
Related Questions
Randomly play audio 0 Answers
Audio Clip Plays 1 turn too late 1 Answer
play audio on touch 1 Answer
Wierd error messages concerning audio play and pause? 1 Answer
Playing audio 1 Answer