Question by
Dragonnoble · Mar 24, 2016 at 12:55 PM ·
audioerror messageaudiosource
BCE0004: Ambiguous reference 'audio': Piano 1.audio, UnityEngine.Component.audio
i'm creating a 3d game where you press a key and noise should play , but i still get the error code. This is my script so far:
@script RequireComponent(AudioSource) var audio : AudioSource;
public var PianoSound1 : AudioClip;
function Start() { audio = GetComponent.(); }
function Update ()
{ if(Input.GetKeyDown(KeyCode.A)) { audio.PlayOneShot(PianoSound1); } }
Comment
Your answer
Follow this Question
Related Questions
Can not play a disabled audio source, but the source is definitely not disabled! 0 Answers
Second AudioClip won't play 0 Answers
Listening to Sound Card Output 0 Answers
Fix sound delay 6 Answers