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 /
avatar image
0
Question by willaay96 · Jul 19, 2016 at 03:27 AM · audiounity 2d

Audio fade in and out?

Is there a way of making audios volume increase and decrease based on a players position in regards to the audio in unity2D?

For example, I have static from a television in one room of the level, however when the player has moved to the next room the static will be quieter and when the player comes back into the television room, the volume increase.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rmassanet · Jul 19, 2016 at 07:17 AM

There's a property in the AudioSource component that lets you configure exactly that behaviour. Set the Spatial Blend property to 2D. Then expand the 3D Sound Settings and configure the decay curve. This curve represents the audio volume as a function of distance to the source.

Comment
Add comment · Show 3 · 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 willaay96 · Jul 20, 2016 at 02:02 PM 0
Share

I was playing around with this, and it doesn't seem like any of the different curve configurations I've used are making it fade at all, is there a specific curve or rollover type that would do this?

avatar image rmassanet willaay96 · Jul 20, 2016 at 02:10 PM 0
Share

Where is your AudioListener attached? By default it is attached to the $$anonymous$$ain Camera. The fade effect is affected by the position of the AudioListener relative to the AudioSource. So, if your camera does not move with the player, then you probably need to remove the AudioListener component from the camera and attach it to the player. You should only have one AudioListener per scene.

avatar image willaay96 rmassanet · Jul 20, 2016 at 05:59 PM 0
Share

Okay, I just changed it and now my Audio listener is on the player ins$$anonymous$$d, but it's still not changing how the sound is recognized.

In the first image, is how far essentially I want the sound to travel, so basically only staying in the room. And the second image is the current settings, (which aren't working). Thank you for helping. alt text alt text

scrnshot1.png (218.7 kB)
scrnshot2.png (25.6 kB)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How can we change default playback device in unity? 2 Answers

Can't stop audio source after going away from trigger 0 Answers

Slider for Game-Wide Audio 0 Answers

Control Sound volume based on scroll rect position 0 Answers

I got an error during the import of an audioclip. 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