x


sound on button press error + its firing when space is pressed

This Is The Error:

Assets/BulletSound.js(6,28): BCE0023: No appropriate version of 'UnityEngine.AudioSource.PlayClipAtPoint' for the argument list '(UnityEngine.AudioClip)' was found.

This Is The Code:

    var GunSound: AudioClip;

function Update(){
if (Input.GetButtonDown("Fire1")){
//shoot the bullet
AudioSource.PlayClipAtPoint(GunSound);
}
}
more ▼

asked Jul 10 '11 at 05:58 PM

buildman99 gravatar image

buildman99
16 6 7 8

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

The error is telling you exactly what's wrong with your code. There is no overload for the method using those parameters. The method requires an AudioSource and a Vector3 as parameters (and an optional float), and you're only passing it an AudioSource. Add a Vector3 there and you're golden.

more ▼

answered Jul 10 '11 at 08:27 PM

Dreamblur gravatar image

Dreamblur
703 9 16 22

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1951
x525
x198
x171
x41

asked: Jul 10 '11 at 05:58 PM

Seen: 885 times

Last Updated: Jul 10 '11 at 08:27 PM