Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by JoaoAlmeida · Feb 07, 2018 at 06:18 PM · audiosourcecar

How can i mute a specific AudioSource?,How to stop a specific AudioSource from playing?,How to mute a specific AudioSource=

Hi guys, my problem is the following: I imported the car asset from the Import Package menu (standard assets). the car got 4 AudioSource hidden that only start playing when the script is called (which means that i cannot modify it out of the Play Mode). I don't want to hear the car when im far from it... Whenever I try to change it via code: public class RangeBetweenObjects : MonoBehaviour {

 public GameObject car;
 public GameObject player;
 public float Distance_;

 void Update()
 {
     Distance_ = Vector3.Distance(car.transform.position, player.transform.position);
     if (Distance_ >= 500)
     {
         car.GetComponent<AudioSource>().enabled = false;
     }
     else
     {
         car.GetComponent<AudioSource>().enabled = true;
     }
 }

}

it simply just get the 1st AudioSource that finds but I want to mute the 3rd one. Be appreciated if someone could help me get through this problem :( ,Hi guys, my problem is the following: I imported the car asset from the Import Package menu (standard assets). the car got 4 AudioSource hidden that only start playing when the script is called (which means that i cannot modify it out of the Play Mode). I don't want to hear the car when im far from it... Whenever I try to change it via code: public class RangeBetweenObjects : MonoBehaviour {

 public GameObject car;
 public GameObject player;
 public float Distance_;

 void Update()
 {
     Distance_ = Vector3.Distance(car.transform.position, player.transform.position);
     if (Distance_ >= 500)
     {
         car.GetComponent<AudioSource>().enabled = false;
     }
     else
     {
         car.GetComponent<AudioSource>().enabled = true;
     }
 }

}

it simply just get the 1st AudioSource that finds but I want to mute the 3rd one. Be appreciated if someone could help me get through this problem :(

,Hi guys, my problem is the following:

I imported the car asset from the Import Package menu, now i want that when im out of a certain range of that car (with my FPSController), a specific AudioSource to be muted (it means that when im too far from the car i dont want to hear it but when im close to it, i want to hear it). the real problems comes when the AudioSources are not displaying in the script but they do when the script is called (after i press Play). I know which AudioSource i should mute, but it doesn't appear when im out of Play Mode. Does anyone know how to help me?

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

125 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sync car audio on UNET network game 0 Answers

car audio pitch help? 1 Answer

I need help getting a sound to play when the E Key is pressed. (E will also load a new Scene). 2 Answers

sound overlap, problems with character controller 0 Answers

How to turn off an audio source when another is being played based on proximity? 0 Answers


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