Multiple Audio Source Problem


I’m trying to add all the gun sounds I need for my FPS game into the gun game object. I’m currently trying to use this to add the firing sound (audio1) and reload sound (audio2) but it doesn’t seem to let me add them in the inspector.

var audio1 : AudioSource;
var audio2 : AudioSource;

Then I use this to call them when it’s firing/reloading…


So, how would I go about using this method of multiple audio sources on one gameObject, to add them in the inspector? When I drag the two audio’s from the project into the inspector slots for audio1 and audio2, they don’t let me put them there. I also tried this with a regular AudioSource but it didn’t let me add more than one.

How can I fix this? Or, is there another (easier) way around this?

Thank you.

I think you may be confused between AudioSources and AudioClips. Here’s a great introduction you might find helpful: