Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Commander Quackers · Dec 07, 2013 at 11:38 PM · gameobjectaudiomultipleonesources

Multiple Audio Source Problem

Hi,

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...

 audio1.Play();
 audio2.Play();
 

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.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tanoshimi · Dec 07, 2013 at 11:44 PM 0
Share

Sounds like you only need one AudioSource, but two AudioClips?

avatar image Commander Quackers · Dec 07, 2013 at 11:49 PM 0
Share

Yes, but it does not let me add them to the inspector, not sure why. Here's how it looks: alt text

When I drag the audios to those variables, they don't go there. Why is this?

f.png (13.1 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Dec 07, 2013 at 11:54 PM

I think you may be confused between AudioSources and AudioClips. Here's a great introduction you might find helpful: http://www.gameaudio101.com/Unity-Audio-Tips.php

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Commander Quackers · Dec 08, 2013 at 12:02 AM 0
Share

Thanks, this did clear up the confusion between audio clips and audio sources, but I'm still unsure of how to solve my problem.

avatar image Commander Quackers · Dec 08, 2013 at 12:16 AM 0
Share

Never $$anonymous$$d, fixed! It let me add two audio sources. I'll accept the answer, though, because it did help quite a bit.

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can I play multiple AudioSources from one gameobject? 8 Answers

Multiple Sound Effects? 1 Answer

Multiple audio samples on one object. 1 Answer

Multiple audioSources on same gameObject? 1 Answer

single script attached to multiple gameobjects, how to find a gameobject, player ontriggerenter's into with that single script ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges